zoukankan      html  css  js  c++  java
  • layui当点击增加的时候,将form中的值获取的添加到table行中代码

     1 layui.use(['table','layer'],function(){
     2     var $=layui.$,
     3         table=layui.table,
     4         layer=layui.layer;
     5      function getParam(){
     6          C1=window.location.href.split('?')[1];
     7          id=C1.split('&')[1].split('=')[1];
     8          id=id.lastIndexOf('#')!=-1?id.split('#')[0]:id;
     9          toolSceneId=C1.split('&')[0].split('=')[1];
    10      }
    11      getParam();
    12      var inParaData;
    13      $.get('/cd/workPlatform/tool/queryPara?toolId='+id+'&type=0',{},function(response){
    14          inParaData=response.data;
    15          table.reload('addDemo1',{data:inParaData});
    16      },"json")
    17     var tableObjIn=table.render({
    18         elem:'#inDemo'
    19         ,dataF:inParaData,
    20         limit:100,
    21         cols:[[
    22             {
    23                 field:'inputName',
    24                 title:'参数名',
    25                 edit:'text',
    26             }, {
    27                 field: 'parameterCode',
    28                 title: '参数英文名',
    29                 edit: 'text'
    30             }, {
    31                 field: 'defaultValue',
    32                 title: '默认值',
    33                 edit: 'text'
    34             },
    35             {
    36                 field: 'description',
    37                 title: '参数描述',
    38                 edit: 'text'
    39             },{
    40                 fixed: 'right',
    41                  178,
    42                 align: 'center',
    43                 title: '操作',
    44                 toolbar: '#inDemoBar'
    45             }
    46         ]],
    47         id:'addDemo1'
    48     });
    49      $('#addInTableRow').click(function () {
    50          $("#inputOne").val('');
    51          $("#inputTwo").val('');
    52          $("#inputThree").val('');
    53          $("#inputfour").val('');
    54          layer.open({
    55              title:'添加输入参数',
    56              type:1,
    57              area:['500px'],
    58              content:$('#layerIn'),
    59              btn:['保存','不保存'],
    60              yes:function (index,layero) {
    61                  var cache=table.cache['addDemo1'];
    62                  var t={};
    63                  var inputName=$('#inputOne').val();
    64                  var parameeterCode=$('#inputTwo').val();
    65                  var reg=/^0-9A-Z$/;
    66                  if(inputName==null||""==inputName){
    67                      layer.msg('参数名不能为空');
    68                      return;
    69                  }
    70                  t["inputName"] = inputName;
    71                  t["parameterCode"] = $('#inputTwo').val();
    72                  t["defaultValue"] = $('#inputThree').val();
    73                  t["description"] = $('#inputfour').val();
    74                  t["inputTypeId"] = 0;
    75                  t["toolId"] = id;
    76                  t["type"] = 0;
    77                  cache.push(t);
    78                  layer.closeAll();
    79                  table.reload('addDemo1',{data:cache});
    80              },
    81              btn2:function (index,layero) {
    82                  layer.closeAll();
    83              }
    84          })
    85      })
    86 })
  • 相关阅读:
    SharePoint 2013中Office Web Apps的一次排错
    如何在Ubuntu上让root帐号可以登录SSH
    如何确定自己的SQL Server的实例是32位的还是64位的?
    [ADO.NET] 如何 使用 OLE DB 讀寫 Excel / 建立 Excel 檔案 (一)
    windows使用nginx实现网站负载均衡测试实例
    jqPlot的Option配置对象详解
    Windows Server 2003安装卡巴斯基2010成功
    Log4Net的使用方法
    在ADO.NET中使用参数化SQL语句的大同小异
    ASP.NET安全问题--Froms验证的具体介绍(中篇)
  • 原文地址:https://www.cnblogs.com/yangguoe/p/8979763.html
Copyright © 2011-2022 走看看