步骤 1:创建 Tabs

  1. <div style="margin-bottom:10px">
  2. <a href="#" class="easyui-linkbutton" onclick="addTab('google','http://www.google.com')">google</a>
  3. <a href="#" class="easyui-linkbutton" onclick="addTab('jquery','http://jquery.com/')">jquery</a>
  4. <a href="#" class="easyui-linkbutton" onclick="addTab('easyui','http://jeasyui.com/')">easyui</a>
  5. </div>
  6. <div id="tt" class="easyui-tabs" style="width:400px;height:250px;">
  7. <div title="Home">
  8. </div>
  9. </div>

步骤 2:实现 'addTab' 函数

  1. function addTab(title, url){
  2. if ($('#tt').tabs('exists', title)){
  3. $('#tt').tabs('select', title);
  4. } else {
  5. var content = '<iframe scrolling="auto" frameborder="0" src="'+url+'" style="width:100%;height:100%;"></iframe>';
  6. $('#tt').tabs('add',{
  7. title:title,
  8. content:content,
  9. closable:true
  10. });
  11. }
  12. }

我们使用 'exists' 方法来判断 tab 是否已经存在,如果已存在则激活 tab。如果不存在则调用 'add' 方法来添加一个新的 tab 面板。

例子:

<table id="HazardousId" class="easyui-datagrid" style="width:auto;height:500px;" ></table>

<div id="shHazardous" style="padding:5px;height:auto">
<div>
<span class="other">
废物类别代码: <input class="easyui-textbox HazardousWType" style="width:130px">
</span>
<span class="other">
废物类别名称: <input class="easyui-textbox HazardousWTypeD" style="width:130px">
</span>
<span class="other">
行业来源: <input class="easyui-textbox industrySources" style="width:130px">
</span>
<span class="other">
废物代码: <input class="easyui-textbox HazardousWCode" style="width:130px">
</span>
<span class="other">
危险废物: <input class="easyui-textbox HazardousWDis" style="width:130px">
</span>
<span class="other">
危险特性: <input class="easyui-textbox HazardousWFeatures" style="width:130px">
</span>
<a id="searchbtn" href="#" class="easyui-linkbutton searchbtn" iconcls="icon-search">Search</a>
</div>
<div>

ESc  浮框退出      table 自适应浏览器窗口

$(function () {
document.onkeyup = function (e) {
e = e || window.event;
var code = e.which || e.keyCode;
if (code == 27) {
$('#dlg').dialog('close');
}
}
$(window).resize(function () {
$('#V3CompanyApplyId').datagrid('resize', {
height: ($(window).height())
});
});
});

$(function () {
var tableId = "HazardousId";
var controller = "Hazardous";
var urlGetTbById = "/" + controller + "/GetHazardousWById";
var urlGetTbOption = "/" + controller + "/MeasurementCalculateOption";

//搜索功能string是类型,strWhere是变量,1=1 是常量,这个本身是没有什么意义的,只是为了方便在后面加上if(字段1 !=“”)
//strWhere +=“ and 字段1 = ”;
//if(字段2 !=“”)
//strWhere +=“ and 字段2 = ”;
//......

//如果字段都为空 还有 where 1=1 呢 也不影响查询,如果 只剩下where 不就报错了么..

$('#shHazardous .searchbtn').on('click', function () {
var strWhere = " 1=1 ";
if ($('.other .HazardousWType').val() != "") {
strWhere += "and T.HazardousWType like '%" + $('.other .HazardousWType').val() + "%'";
}
if ($('.other .HazardousWTypeD').val() != "") {
strWhere += "and T.HazardousWTypeD like '%" + $('.other .HazardousWTypeD').val() + "%'";
}
if ($('.other .industrySources').val() != "") {
strWhere += "and T1.industrySources like '%" + $('.other .industrySources').val() + "%'";
}
if ($('.other .HazardousWCode').val() != "") {
strWhere += "and T2.HazardousWCode like '%" + $('.other .HazardousWCode').val() + "%'";
}
if ($('.other .HazardousWDis').val() != "") {
strWhere += "and T2.HazardousWDis like '%" + $('.other .HazardousWDis').val() + "%'";
}
if ($('.other .HazardousWFeatures').val() != "") {
strWhere += "and T2.HazardousWFeatures like '%" + $('.other .HazardousWFeatures').val() + "%'";
}
console.log(strWhere);
$('#' + tableId).datagrid("reload", { strWhere: strWhere, page: 1, rows: 10 });
});

var StorageManager = [
{
type: 1,
key: "HazardousWType",
name: "废物类别代码",
val: "",
dpData: ""
},
{
type: 1,
key: "HazardousWTypeD",
name: "废物列别名称",
val: "",
dpData: ""
},
{
type: 1,
key: "industrySources",
name: "行业来源",
val: "",
},
{
type: 1,
key: "HazardousWCode",
name: "废物代码",
val: "",
},
{
type: 1,
key: "HazardousWDis",
name: "危险废物",
val: "",
},
{
type: 1,
key: "HazardousWFeatures",
name: "危险特性",
val: "",
}];

function UIModifyInit(index, type) {
$.ajax({
url: rootUrl + urlGetTbById,
data: { id: index },
async: false,     //false为同步         默认是true;
type: "POST",
success: function (msg) {
//alert(msg);
//msg = $.parseJSON(msg);
if (msg.success = true) {
console.log(msg);
dataOption.msgToModelCompany($.parseJSON(msg.Memo)[0], StorageManager, 1);
dataOption.createDom(StorageManager, "userInfoSelect", type);

}
else {
// console.log(msg.msg);
}
},
dataType: "json"
});

};
$('#' + tableId).datagrid({
height: 500,
url: rootUrl + '/' + controller + '/GetHazardousW',
method: 'post',
fixColumnSize: true,       // 固定列的尺寸
striped: true,                 // 就把行条纹化。(即奇偶行使用不同背景色)
fitColumns: true,           //自动扩大或缩小列的尺寸以适应表格的宽度并且防止水平滚动。
fit: true,                       //折叠容器的大小将填充父容器   自适应
singleSelect: false,         //设置为 true,则只允许选中一行。
rownumbers: true,          //显示带有行号的列
pagination: true,             //True 就会在datagrid 的底部显示分页栏
nowrap: false,                 //超出部分换行
pageSize: 20,                   //初始化页码尺寸
pageList: [10, 20, 50, 100, 150, 200],         //初始化页面尺寸的选择列表
showFooter: true,              
pageNumber: 1,           //初始化页码。
toolbar: '#shHazardous',
columns: [[
{ field: 'HazardousWType', title: '废物类别代码', width: '10%', align: 'center', fixed: 'true' },
{ field: 'HazardousWTypeD', title: '废物类别名称', width: '15%', align: 'center', fixed: 'true' },
{ field: 'industrySources', title: '行业来源', width: '15%', align: 'center', fixed: 'true' },
{ field: 'HazardousWCode', title: '废物代码', width: '10%', align: 'center', fixed: 'true' },
{ field: 'HazardousWDis', title: '危险废物', width: '40%', align: 'center', fixed: 'true' },
{ field: 'HazardousWFeatures', title: '危险特性', width: '10%', align: 'center', fixed: 'true' },
//{
// field: 'Id', title: '详细信息', width: '10%', align: 'center',
// formatter: function (value, row, index) {
// var addHtml = '<a class="approveApply ob-details" ob-id=' + row.id + ' style="color:blue">详细信息</a>';
// return addHtml ;
// }
// },
]],
onDblClickRow: function (rowIndex, rowData) {
$('#dlg').dialog('open');
UIModifyInit(rowData.id, 1);
$('.ob-addBtn').remove();
}
});
$('#' + tableId).prev().on("click", ".ob-details", function () {
$('#dlg').dialog('open');
UIModifyInit($(this).attr("ob-id"), 1);
$('.ob-addBtn').remove();
});
});
</script>

转载于:https://www.cnblogs.com/sjd1118/p/7029191.html

easyui 动态添加标签页,总结相关推荐

  1. Android高仿网易新闻客户端之动态添加标签

    承接上一篇文章:Android高仿网易新闻客户端之首页,今天来实现动态添加标签效果. 动态标签页是一个流式布局,实现了宽度自动换行高度自动分配的功能,代码如下: FlowLayout.java pac ...

  2. 安卓java代码标签_Android实现动态添加标签及其点击事件

    在做Android开发的时候,会遇到动态添加标签让用户选择的功能,所以自己写了个例子,运行效果图如下. 标签可以左右滑动进行选择,点击的时候,会弹出toast提示选择或者取消选择了哪个标签.通过动态添 ...

  3. jQuery EasyUI动态添加控件或者ajax加载页面后不能自动渲染问题的解决方法

    博客分类: jquery-easyui jQueryAjax框架HTML  现象: AJAX返回的html无法做到自动渲染为EasyUI的样式.比如:class="easyui-layout ...

  4. JS动态修改页面EasyUI datebox不生效、EasyUI动态添加Class、EasyUI动态渲染解析解决方案

    JS动态修改页面EasyUI datebox不生效.EasyUI动态添加Class.EasyUI动态渲染解析解决方案 参考文章: (1)JS动态修改页面EasyUI datebox不生效.EasyUI ...

  5. jquery ajax添加ul li,jQuery.ajax动态添加标签无法被获取到

    问题:在ajax中获取数据后为页面动态添加 标签,点击标签时,无法执行jQuery的onClick方法 原因:添加 标签的方法在ajax方法内部,而jQuery的onClick方法在ajax方法的外部 ...

  6. jquery 动态添加标签而且指定样式

    在jsp页面中给jquery 动态添加标签而且指定样式: $("#id").append("<span style='color:red........'>& ...

  7. Android 动态添加标签及其点击事件

    在做Android开发的时候,会遇到动态添加标签让用户选择的功能,所以自己写了个例子,运行效果图如下. 标签可以左右滑动进行选择,点击的时候,会弹出toast提示选择或者取消选择了哪个标签.通过动态添 ...

  8. EasyUI中Tabs标签页的简单使用

    场景 效果 属性 tabs none 返回全部的标签页面板(tab panel). resize none 调整标签页(tabs)容器的尺寸并做布局. add options 添加一个新的标签页面板( ...

  9. js动态添加html页签(JavaScript 拼接html标签代码)

    目录 情形:需求 实现:分析 实现 页面:前端 总结:仔细再仔细 情形: 最近遇到这样一个情况: 需要实现动态增加页面,可以添加页面,页面的内容需要能保存,修改和删除. 页面的名字可编辑,并且要实现单 ...

  10. element ui Tag 动态添加标签

    1.首先调接口获取到标签列表, // 级联选择器如果选择的不是第三级菜单async getParamsData() {if (this.selectedCateKeys.length !== 3) { ...

最新文章

  1. 添加MySql数据库超时设置的相关问题
  2. 一句话搞定webmap(一)——轻地图组件
  3. 秋冬季节吃什么水果好
  4. docker-compose单机容器编排工具
  5. loj 2542 随机游走 —— 最值反演+树上期望DP+fmt
  6. Django运维后台的搭建之二:建立template和对应的ModelForm
  7. SD-WAN三大部署方式 用户现身说法谈优劣势
  8. 多实例linux自动启动,Linux 下自动启动多个oracle实例
  9. JQuery实现radio、select、checkbox禁用
  10. 【英语】Flying By Dream---English
  11. python如何画出多个独立的图片_python使用matplotlib:subplot绘制多个子图的示例
  12. 常用音频单位简介:dBSPL、dBm、dBu、dBV、dBFS
  13. python绘图画猫咪_Turtle库画小猫咪
  14. C# QQ连连看外挂(内存版)源代码
  15. 操作系统——并发之锁
  16. PMCAFF微课堂|范冰:Growth Hacker——用能量颠覆你的想象
  17. 阅读笔记之《DisenQNet: Disentangled Representation Learning for Educational Questions》
  18. 目标检测—RCNN系列
  19. MySQL高级篇知识点——其它数据库日志
  20. 《光耦元器件》的特性分析

热门文章

  1. 软件基本功:start()不能作为函数名,可以作为类方法名
  2. 喜庆本博客成为CSDN博客专家
  3. WINDOWS下git的安装与使用
  4. 谈谈纽微特3万SIP奖金的事
  5. 门描述符gate descriptors
  6. 64位程序如何调用32位dll(简单解决方案 )
  7. 如何让Java文件在虚拟机中运行_深入理解JVM--Java程序如何在虚拟机中运行
  8. sa linux,sa | 搜索结果 | Linux运维部落
  9. 谈谈计算机专业职业技能,计算机专业职业技能论文
  10. vue computed 传参_前端面试时面试官想要听到什么答案(关于一些Vue的问题)