zoukankan      html  css  js  c++  java
  • 在layui layer 弹出层中加载 layui table

     1 layui.use('table', function(){
     2                 var table = layui.table;
     3                 layer.open({
     4                 type : 1,
     5                 area : [ "600px", '430px' ],
     6                 title : "选择模板",
     7                 maxmin : false,
     8                 content : '<div><table id="templateTable"></table></div>',
     9                 success : function(index, layero) {
    10                     
    11                       table.render({
    12                         elem: '#templateTable'
    13                         ,height: 300
    14                         ,'100%'
    15                        ,url: '${ctx}/oa/wzsc/oaWzscTemplate/listJson' //数据接口
    16                        
    17                         ,page: true //开启分页
    18                         ,cols: [[ //表头
    19                             {type:'radio'}
    20                           ,{field: 'name', title: '模板名称', 200, sort: true}
    21                           ,{field: 'detail', title: '描述', 330}
    22                            ,{field: 'id', title: 'ID', 200,hide:true}
    23                           
    24                         ]]
    25                       });
    26                     
    27                 },
    28                 
    29                 btn : [ '确定', '关闭' ],
    30                 yes : function(index, layero) {
    31                         var checkStatus = table.checkStatus('templateTable'); //
    32                         var datas = checkStatus.data;//选中的数据
    33                         if(datas.length > 0){
    34                             var selectData = datas[0];
    35                              var tpid = selectData.id;
    36                              var tpname = selectData.name;
    37                              $('#tpId').val(tpid);
    38                              $('#tpName').val(tpname);
    39                              try{
    40                                  layer.close(index);//关闭对话框.
    41                              }catch(e){
    42                                  setTimeout(function(){layer.close(index)}, 100);//延时0.1秒,对应360 7.1版本bug
    43                              }
    44                         }else{
    45                             layer.msg('请选择一个模板!');
    46                         }
    47                          
    48                     }
    49                 });
    50             });
  • 相关阅读:
    MySQL之存储引擎
    MySQL之基础功能
    MySQL之正则表达式
    MySQL之数据类型
    MySQL之多表查询
    MySQL之单表查询
    linux命令useradd添加用户详解
    MySQL之数据操作
    MySQL之表操作
    MySQL之库操作
  • 原文地址:https://www.cnblogs.com/dirgo/p/10080978.html
Copyright © 2011-2022 走看看