layui框架中左樹右表只刷新數據不刷新頁面的方法


layui框架中左樹右表只刷新數據不刷新頁面的方法

  table.render({
   elem: '#userdata'
  ,url: '/fjcj/jcxxMst/pageQuery'
  ,method:'post'
  ,cols: [[
        {type: 'numbers', title: '序號', width: '40'}
      ,{field: 'xm', width: 100, title: '姓名'}
      ,{field: 'acc', width: 100, title: '輔警賬號'}
      ,{field: 'xb', width: 100, title: '性別', width: 90,templet:'#userSex'}
      ,{field: 'sfzh', width: 100, title: '身份證號',width: '180'}
      ,{field: 'ryzt', title: '狀態', width: 60, templet:'#userStatus'}
      ,{title: '操作', align: 'center', width: '200', toolbar: '#table-system-user'}
  ]]
  ,page: true
  ,limit: 10
  ,limits: [10, 20, 30 ,40 ,50]
  ,text: {none: '暫無數據'}
  ,done: function(){
       element.render('progress')
  }
});
  table.on('tool(userdata)', function(obj){
   var data = obj.data;
   if(obj.event === "del"){
           layer.confirm("你確定要刪除該用戶嗎?",{btn:['是','否']},
             function(){
                   $.post("/fjcj/jcxxMst/delete",{"id":data.id},function (res){
                      if(res.success){
                          layer.msg("刪除成功",{time: 400},function(){
                        obj.del();
                              dataReload(data);  //只刷新數據不刷新頁面
                           
                          });
                      }else{
                          layer.msg(res.message, {icon: 5});
                      }
                  });
              }
          )
      }


  });
  //監聽搜索
  form.on('submit(searchForm)', function (data) {
      selectUserIds ="";
      dataReload(data);
  });

  function dataReload(data){
      var field = data.field;
     table.reload('userdata', {
        page:{
           curr:1
        },
        where: field
      });
}




免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM