博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
layui实现点击按钮添加行(方法渲染创建的table)
阅读量:5742 次
发布时间:2019-06-18

本文共 5849 字,大约阅读时间需要 19 分钟。

/ jquery实现的搜索功能    $('#search_btn').on('click',function(){        var txt=$('#inputValue').val();        var value=$('.layui-colla-content');        if($.trim(txt)!=""){            $(".layui-colla-content").css('display','none').filter(":contains('"+txt+"')").show().css("color","red");        }else{            alert('111');        }    })table.render({           elem: '#baseInfo'            ,data:tableData            ,cols: [[            {title : '序号',type:'numbers',Width: 20}              /*  ,{field:'tableId'  , title:'tableId' }              ,{field:'dbId'     , title:'dbId'    } */               ,{field:'colNo'    , title:'colNo'   , sort: true}               ,{field:'domainId' , title:'domainId', minWidth: 120, templet: '#switchTpl', unresize: true }               ,{field:'colName'  , title:'colName' , minWidth: 120, sort: true           , edit: 'text'}               ,{field:'typeName' , title:'typeName', minWidth: 120, sort: true   ,templet: '#selectTpl'}               ,{field:'scale'    , title:'scale'   , minWidth: 80,  edit: 'text'}               ,{field:'notNull'  , title:'notNull' , minWidth: 100, templet: '#switchNullTpl', unresize: true}                 ]]            ,page: { //支持传入 laypage 组件的所有参数(某些参数除外,如:jump/elem) - 详见文档             layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局             ,curr: 1 //设定初始在第 1 页             ,groups: 1 //只显示 1 个连续页码             ,first: false //不显示首页             ,last: false //不显示尾页           }            , done: function(res, curr, count){                 }           });  table.render({           elem: '#baseInfo'            ,data:tableData            ,cols: [[            {title : '序号',type:'numbers',Width: 20}              /*  ,{field:'tableId'  , title:'tableId' }              ,{field:'dbId'     , title:'dbId'    } */               ,{field:'colNo'    , title:'colNo'   , sort: true}               ,{field:'domainId' , title:'domainId', minWidth: 120, templet: '#switchTpl', unresize: true }               ,{field:'colName'  , title:'colName' , minWidth: 120, sort: true           , edit: 'text'}               ,{field:'typeName' , title:'typeName', minWidth: 120, sort: true   ,templet: '#selectTpl'}               ,{field:'scale'    , title:'scale'   , minWidth: 80,  edit: 'text'}               ,{field:'notNull'  , title:'notNull' , minWidth: 100, templet: '#switchNullTpl', unresize: true}                 ]]            ,page: { //支持传入 laypage 组件的所有参数(某些参数除外,如:jump/elem) - 详见文档             layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局             ,curr: 1 //设定初始在第 1 页             ,groups: 1 //只显示 1 个连续页码             ,first: false //不显示首页             ,last: false //不显示尾页           }            , done: function(res, curr, count){                 }           });  table.render({           elem: '#baseInfo'            ,data:tableData            ,cols: [[            {title : '序号',type:'numbers',Width: 20}              /*  ,{field:'tableId'  , title:'tableId' }              ,{field:'dbId'     , title:'dbId'    } */               ,{field:'colNo'    , title:'colNo'   , sort: true}               ,{field:'domainId' , title:'domainId', minWidth: 120, templet: '#switchTpl', unresize: true }               ,{field:'colName'  , title:'colName' , minWidth: 120, sort: true           , edit: 'text'}               ,{field:'typeName' , title:'typeName', minWidth: 120, sort: true   ,templet: '#selectTpl'}               ,{field:'scale'    , title:'scale'   , minWidth: 80,  edit: 'text'}               ,{field:'notNull'  , title:'notNull' , minWidth: 100, templet: '#switchNullTpl', unresize: true}                 ]]            ,page: { //支持传入 laypage 组件的所有参数(某些参数除外,如:jump/elem) - 详见文档             layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局             ,curr: 1 //设定初始在第 1 页             ,groups: 1 //只显示 1 个连续页码             ,first: false //不显示首页             ,last: false //不显示尾页           }            , done: function(res, curr, count){                 }           });  table.render({           elem: '#baseInfo'            ,data:tableData            ,cols: [[            {title : '序号',type:'numbers',Width: 20}              /*  ,{field:'tableId'  , title:'tableId' }              ,{field:'dbId'     , title:'dbId'    } */               ,{field:'colNo'    , title:'colNo'   , sort: true}               ,{field:'domainId' , title:'domainId', minWidth: 120, templet: '#switchTpl', unresize: true }               ,{field:'colName'  , title:'colName' , minWidth: 120, sort: true           , edit: 'text'}               ,{field:'typeName' , title:'typeName', minWidth: 120, sort: true   ,templet: '#selectTpl'}               ,{field:'scale'    , title:'scale'   , minWidth: 80,  edit: 'text'}               ,{field:'notNull'  , title:'notNull' , minWidth: 100, templet: '#switchNullTpl', unresize: true}                 ]]            ,page: { //支持传入 laypage 组件的所有参数(某些参数除外,如:jump/elem) - 详见文档             layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局             ,curr: 1 //设定初始在第 1 页             ,groups: 1 //只显示 1 个连续页码             ,first: false //不显示首页             ,last: false //不显示尾页           }            , done: function(res, curr, count){                 }           });  //点击加号按钮时,新添一行       $("#addTable").click(function(){            var oldData =  table.cache["baseInfo"];            var data1={"colName":"ID2","colNo":0,"collator":"","comments":"","dbId":1,"defVal":"","deleted":"","dispersion":0,"domainId":0,"histogram":"","isHide":"","isSerial":"F","isVirtual":"","maxVal":"","minVal":"","notNull":"T","repetRate":0,"scale":-1,"serialId":0,"tableId":1048586,"timestampT":" ","typeName":"INTEGER","varying":"F","vcolNo":0,"vertNo":0};            oldData.push(data1);            table.reload('baseInfo',{                data : oldData            });       });

 

转载地址:http://wwizx.baihongyu.com/

你可能感兴趣的文章
如何搭建基于ldap和mysql的gerrit服务
查看>>
ajax可以伪造的头部信息
查看>>
Guava库学习:学习Concurrency(八)Futures
查看>>
Go基础
查看>>
如何直接访问类的私有成员???
查看>>
【亲测】win7设置让PC变身无线热点共享给手机上网
查看>>
linux基础学习之开机自动挂载分区
查看>>
PWA实践
查看>>
2015.3.18第五次课程
查看>>
报错-Type ViewController doesnot conform to protocol
查看>>
Mycat1.6基础用法之--简单实现mysql高可用
查看>>
collections.OrderedDict
查看>>
ubuntu上部署ceph集群
查看>>
JS的构造函数
查看>>
第十七章、LVM
查看>>
github简单使用教程
查看>>
Web前端 个人笔记(未完待续...)
查看>>
java中IO类的各种操作
查看>>
我的友情链接
查看>>
haproxy实现discuz论坛的动静分离和负载均衡
查看>>