var organdata = []; $.ajax({ url: baseurl+'/org/getsysorglist' ,type:"post" ,async:false ,datatype:"json" , success: function(result){ organdata=result; } });
2、将数据通过data方式传值
table.render({ elem: '#organ-manage-list' ,data:organdata ,method:'post' ,cols: [[ {field: 'orgcode', width: 100, title: '组织编码', sort: true} ,{field: 'orgname', title: '组织名称', width: 200} ,{field: 'porgcode', title: '上级行政组织', width: 100} ,{field: 'orgmodal', title: '组织形态', width: 100} ,{field: 'isselforg', title: '是否核算组织', width: 100} ,{field: 'status', title: '启/停用', width: 100} ,{field: 'updtime', title: '更新时间', width: 200} ,{title: '操作',align:'center', fixed: 'right', toolbar: '#table-organ-operator'} ]] ,page: true ,limit: 10 ,height: 'full-220' ,done: function(res, curr, count){ //如果是异步请求数据方式,res即为你接口返回的信息。 //如果是直接赋值的方式,res即为:{data: [], count: 99} data为当前页数据、count为数据总长度 sessionstorage.setitem("counttemp",count); } ,text: '对不起,加载出现异常!' });
更多layui知识请关注layui教程栏目
以上就是layui实现点击按钮添加一行的方法的详细内容。
