zoukankan      html  css  js  c++  java
  • easyui中加载table列表数据 第一次有数据第二次没有数据问题

      $('#allUsingProductTable').datagrid({  加载数据时,第二加载时table会发生变化会出现找不到问题。如果是弹框没有影响,弹框出现出现列表每次都会执行销毁方法。

    解决办法

    发送ajax请求获取数据,用$('#usingProductTableUpdate').datagrid('loadData', data.rows);加载数据

    $(function(){
    $('#usingProductTableUpdate').datagrid({
    'auto',
    height:'200px',
    striped: true,
    fit: true,
    pagination: true,
    scrollbarSize: 0,
    singleSelect: true,
    url:'',
    loadMsg: '数据加载中请稍后……',
    columns: [[{
    field: 'bad_survey_no',
    title: '不良调查编号',
    align: 'center',
    resizable: false,
    '10%'
    },{
    field: 'product_name',
    title: '商品名称',
    align: 'center',
    resizable: false,
    '15%'
    },{
    field: 'product_no',
    title: '产品编号',
    align: 'center',
    resizable: false,
    '18%'
    }, {
    field: 'starttime_frame',
    title: '用药开始时间',
    align: 'center',
    resizable: false,
    '18%'
    }, {
    field: 'endtime_frame',
    title: '用药结束时间',
    align: 'center',
    resizable: false,
    '18%'
    }, {
    field: 'common_name',
    title: '通用名称',
    align: 'center',
    resizable: false,
    '16%'
    }
    ]],
    method: 'post',
    toolbar: [{
    text:'清空',
    iconCls: 'icon-help',
    handler: function(){
    var row=$('#badSurveyTable').datagrid('getSelected');
    if(row){
    $.messager.confirm('删除数据', '您确定清空数据吗?', function(r){
    //清空类表数据
    $('#usingProductTableUpdate').datagrid('loadData', {total: 0, rows: []});
    });

    }else{
    $.messager.show({
    title:'提示',
    msg: '至少选择一条',
    showType:'show'
    });
    }

    }
    }]
    });
    })
    function updateUsing(bad_survey_no){

    $.post('<%=basePath%>survey/findAddUsingProductmsg.do?bad_survey_no='+bad_survey_no,
    function (data) {
    //alert(data.rows)
    $('#usingProductTableUpdate').datagrid('loadData', data.rows);
    },'json');
    }

  • 相关阅读:
    SpringBoot实现原理
    常见Http状态码大全
    forward(转发)和redirect(重定向)有什么区别
    1094. Car Pooling (M)
    0980. Unique Paths III (H)
    1291. Sequential Digits (M)
    0121. Best Time to Buy and Sell Stock (E)
    1041. Robot Bounded In Circle (M)
    0421. Maximum XOR of Two Numbers in an Array (M)
    0216. Combination Sum III (M)
  • 原文地址:https://www.cnblogs.com/xianz666/p/12052931.html
Copyright © 2011-2022 走看看