lidatui / mmGrid

mmGird是一个基于jQuery的表格控件
http://lidatui.github.io/mmGrid
225 stars 124 forks source link

接更换url,不能动态更新表格的数据 #34

Closed serenaxx closed 10 years ago

serenaxx commented 10 years ago

第一次进入页面,load mmGrid以后,点击链接更换url后,mmGrid无法更新数据。后一次load 需要传url和参数,怎么传才能更新数据,或者刷新新的数据。

serenaxx commented 10 years ago

第一次load: var mmg = $('.mmg').mmGrid({ height: 990, cols: cols, url:'default.php', method: 'post', remoteSort:false, ache:false, root:'info', loadingText:'正在载入...', sortName: 'highp', sortStatus: 'desc', checkCol: false, fullWidthRows: true, autoLoad: false, plugins: [

              $('#pg').mmPaginator({})
         ]
   }).load();

第二次: $("#btnSel").bind("click",function(){ var p_pack = $(".text").val();

    $.post(
        "pay.php",
        {
        PName : p_pa,
        },
    function(data){
                        $('.mmg').mmGrid({
                    height: 990, 
                    cols: cols, 
                    items: data,                                
                    sortName: 'everp', 
                    sortStatus: 'desc',   
                    checkCol: false, 
                    plugins: [

                    $('#pg').mmPaginator({})
                    ]
             }).load(); 

         },

         'json'
    );

数据没有更新,pay.php执行后,又执行了default.php,数据貌似被覆盖了,该怎么样修改

lidatui commented 10 years ago

现在mmGrid是不能动态的更换url的。我认为你可以考虑为你的url加不同参数来获得不同的结果集,比如

$("#btnSel").bind("click",function(){
  mmg.load({
    type: "pay",
    pName: $(".text").val();
  });
}