1.原代码:

<body>
<div id="showalladdableavms" style="display: none;width:100%">
<table id="demo" lay-filter="test"></table>
</div> -->
</body>
<script>
filldata(table,"#demo","getDateForUserJurisdiction.gds");
layer.open({
type:1,
title:"添加机器",
maxmin:true,
area:["100%","100%"],
btn:["确认添加"],
content: $("#showalladdableavms").html(),
success: function (layero) {
var btn = layero.find('.layui-layer-btn');
btn.css({'position':'relative','top':"-93%","text-align":"left","left":"8%"});
},
btn1:function(index, layero){
//console.log(layero, index);
var res = getoperavms('demo');
console.dir(res)
}
});
function filldata(table,id,url){
table.render({
elem: id,
height:"560"
,url:url //数据接口
,method: 'POST'
,cellMinWidth: 80 //全局定义常规单元格的最小宽度,layui 2.2.1 新增
,page:true/* { //支持传入 laypage 组件的所有参数(某些参数除外,如:jump/elem) - 详见文档
first: true //显示首页
,last: true //显示尾页
} */
,limits : [10,20,30]
,limit:10
,request: {
pageName: 'page',//页码的参数名称,默认:page
}
,cols: [[ //表头
{checkbox:true}
,{field: 'id', title: 'ID', width:80, sort: true}
,{field: 'avm', title: '机器编号', width:80}
,{field: 'company', title: '公司名称', width:80}
,{field: 'area', title: '区域', width:80, sort: true}
,{field: 'circuit', title: '线路', width:80}
,{field: 'position', title: '位置', width: 177}
,{field: 'goodsxml', title: '商品库', width: 80, sort: true} ]]
,where : {
//传值 startDate : startDate,
allavm:'yes'
}
,response: {
// statusName: 'code' //数据状态的字段名称,默认:code
//,statusCode: 200 //成功的状态码,默认:0
//,msgName: 'message' //状态信息的字段名称,默认:msg
countName: 'total' //数据总数的字段名称,默认:count
,dataName: 'rows' //数据列表的字段名称,默认:data
}
/* done:function(){
layer.open({
type:1,
maxmin:true,
area:["800px","600px"],
content: $("#showalladdableavms")
});
} */
});
} </script>

2.现象:分页,选择框等无法操作,查了查说是使用html()方式得到的内容会丢失dom对象的事件,如果直接用dom会出现一直无法展示dom内容的问题。

3.解决:动态添加:

var dom = $("<div id='showalladdableavms' style='display:none;width:100%'><table id='demo' lay-filter='test'></table></div>");
$('body').append(dom)

这种方式可以很好的解决写死在页面里的dom对象打开时不展示,显示呈暗灰色调的问题,同时,dom对象的事件也得到了支持,完美

layui之layer打开table后分页无效的解决方法的更多相关文章

  1. 表格Table宽度设置无效的解决方法

    表格Table宽度设置无效的解决方法 bootstrap中使用table时发现不管用width赋值方式都无法改变table>td的宽度 解决方法: 设置table:table-layout:fi ...

  2. 用Mindjet MindManager 15 打开文件后停止响应的解决方法

    这个是因为文件里面有很多规格不统一的注释(那个像小本子的图标[里面就是注释部分]),默认编码是utf-8的,如果不一样的话就会出现这个问题.网上大多数都是让咱们删掉注释再打开 弱弱的问一下,如果我都把 ...

  3. (转)WEB页面导出为Word文档后分页&横向打印的方法

    <html>    <HEAD>        <title>WEB页面导出为Word文档后分页&横向打印的方法 </title>    < ...

  4. 设置height:100%无效的解决方法

    设置height:100%无效的解决方法 刚接触网页排版的新手,常出现这种情况:设置table和div的高height="100%"无效,使用CSS来设置height:" ...

  5. redhat linux enterprise 5 输入ifconfig无效的解决方法

    redhat linux enterprise 5 输入ifconfig无效的解决方法   在安装完成linux后,进入终端,输入命令行ifconfig,会提示bash: ifconfig: comm ...

  6. windows 10 删除库后自动恢复的解决方法

    目录 什么是windows 库? 手动删除不行吗? 如何正确的"删除"? title: windows 10 删除库后自动恢复的解决方法 date: 2019-06-09 15:4 ...

  7. WPF:指定的命名连接在配置中找不到、非计划用于 EntityClient 提供程序或者无效的解决方法

    文/嶽永鹏 WPF 数据绑定中绑定到ENTITY,如果把数据文件做成一个类库,在UI文件中去应用它,可能遇到下面这种情况. 指定的命名连接在配置中找不到.非计划用于 EntityClient 提供程序 ...

  8. 移动端bug~~移动端:active伪类无效的解决方法【移动端 :active样式无效】

    移动端:active伪类无效的解决方法[移动端 :active样式无效]2016-09-26  15:46:50 问题: 移动端开发的时候实现按钮的点击样式变化,但是在iphone[safiri Mo ...

  9. js中style.display=""无效的解决方法

    本文实例讲述了js中style.display=""无效的解决方法.分享给大家供大家参考.具体解决方法如下: 一.问题描述: 在js中我们有时想动态的控制一个div显示或隐藏或更多 ...

随机推荐

  1. OpenCV - Windows(win10)编译opencv + opencv_contrib

    在之前的几篇文章中,我提到了在Android.Linux中编译opencv + opencv_contrib,这篇文章主要讲在Windows中编译opencv + opencv_contrib. 首先 ...

  2. ACM学习历程—SGU 275 To xor or not to xor(xor高斯消元)

    题目链接:http://acm.sgu.ru/problem.php?contest=0&problem=275 这是一道xor高斯消元. 题目大意是给了n个数,然后任取几个数,让他们xor和 ...

  3. JAVA JDBC 读取配置文件链接数据库(oracle)

    ----db.properties-------- dbDriver = oracle.jdbc.driver.OracleDriverurl = jdbc:oracle:thin:@192.168. ...

  4. Bootstrap CSS教程

    Bootstrap 教程 Bootstrap,来自 Twitter,是目前最受欢迎的前端框架.Bootstrap 是基于 HTML.CSS.JAVASCRIPT 的,它简洁灵活,使得 Web 开发更加 ...

  5. powermock, 强力模拟

    1. powermock是基于mockito或者easymock,TestNG之上的mock: 2. 提供了对于静态函数,私有函数的mock 3. 下载地址:https://github.com/po ...

  6. Poj 1936,3302 Subsequence(LCS)

    一.Description(3302) Given a string s of length n, a subsequence of it, is defined as another string ...

  7. C++STL 库中set容器应用

    #include<iostream> #include<cstdio> #include<set> using namespace std; set<int& ...

  8. ML 徒手系列 最大似然估计

    1.最大似然估计数学定义: 假设总体分布为f(x,θ),X1,X2...Xn为总体采样得到的样本.其中X1,X2...Xn独立同分布,可求得样本的联合概率密度函数为: 其中θ是需要求得的未知量,xi是 ...

  9. content-disposition attachment filename 在Firefox和IE中得到不同的结果

    在Firefox中需要把filename 用双引号包起来,才能得到想要的名字,不然如果含有空格,会丢掉空格后面的部分.而IE会把空格转为_,因此也需要HttpUtility.UrlPathEncode ...

  10. struts 文件上传示例

    import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io ...