处理Easyui的Datagrid无法及时刷新问题

在Easyui中打打开窗口dialog控件,当做完修改操作之后,关闭dialog控件刷新Datagrid,有时候无法及时刷新。

1、JavaScript中的代码

[javascript] view plaincopy
 
  1. function doEdit(){                  
  2.         var timeText=$('#type2').combobox('getText');  
  3.         var timeValue=$('#type2').combobox('getValue');  
  4.         if(timeText==timeValue){  
  5.             timeText="";  
  6.             timeValue="";  
  7.         }  
  8.         $.messager.defaults={ok:"确定",cancel:"取消"};   
  9.         $.messager.confirm('Confirm', '您确定修改?', function(r){  
  10.             if (r){  
  11.                 $.ajax({  
  12.                        type: "POST",  
  13.                        url: "load!editDowntable.action",  
  14.                        data:"edit_id="+ $('#id2').val()+"&edit_title="+$('#title2').val()+"&edit_persontype="+timeValue+"&edit_cpersontype="+timeText+"&edit_loadtime="+$('#time2').datetimebox('getValue')  
  15.                                      
  16.                 });  
  17.                   }          
  18.             $('#editDlg').dialog('close');  
  19.             $('#tt').datagrid({  
  20.                 url:"load!queryTable.action"  
  21.   
  22.             });  
  23.               
  24.         });  
  25.           
  26.           
  27.     }<pre name="code" class="javascript"></pre><br>  


2、html中的代码

[html] view plaincopy
 
    1.    <table id="tt">          
    2.      <thead>  
    3.         <th data-options="field:'title',title:'标题',140"></th>  
    4.         <th data-options="field:'cpersontype',title:'类型',120"></th>  
    5.         <th data-options="field:'loadtime',title:'创建时间',120,formatter:formattime"></th>  
    6.     </thead>      
原文地址:https://www.cnblogs.com/henuyuxiang/p/4283017.html