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. 学习完Spring MVC体会

    学习完spring mvc感觉很不错,万事开头难,付出定有回报,坚持必将成功

  2. git branch detached from jb4.2.2_1.0.0-ga

    /*************************************************************************** * git branch detached f ...

  3. tornado 获取参数

    self.get_argument('name') 没有传递name就报400错误了 tornado.web.MissingArgumentError: HTTP 400: Bad Request ( ...

  4. UnityShader实例15:屏幕特效之Bloom

    http://blog.csdn.net/u011047171/article/details/48522073 Bloom特效       概述        Bloom,又称“全屏泛光”,是游戏中 ...

  5. DSP基础

    CCS V5的使用 CCS安装与设置

  6. linux获取文件大小的函数

    C语言fstat()函数:由文件描述词取得文件状态 头文件:#include <sys/stat.h>   #include <unistd.h> 定义函数:int fstat ...

  7. Sql server 2008 R2 导出/导入数据报错之无法打开全局共享内存以与性能 DLL 通信

  8. 同名项目复制,发布新项目,提示已存在该项目于webapp

    来自为知笔记(Wiz)

  9. 线程中t.setdaemon(), t.jion(), t.start的使用

    import threading import time def f0(): pass def f1(a1,a2): time.sleep(10) f0() ") t1 = threadin ...

  10. [trie]字典树模板

    #include<bits/stdc++.h> using namespace std; typedef long long ll; struct trie{ int count; tri ...