EasyUI Forum

General Category => General Discussion => Topic started by: Spike on December 03, 2014, 04:28:13 AM



Title: succes updating datagrid, timing reload problem
Post by: Spike on December 03, 2014, 04:28:13 AM

Hello,

I have a small problem with timing the reload (refresh) of a Datagrid;
The URL in the $Ajax call updates the data in the MYSQL database

Everything is working fine but the grid reload is sometimes "refreshed" BEFORE the URL has done it's job.
 
How can I do the "reload" of the grid after I am sure the update of the URL php script has done it's work?
(when I do a refresh manually after 2 seconds the grid refreshes perfect....)

Thanx in advance,

Spike

   function valideer_factuur(){
      var row = $('#dg').datagrid('getSelected');
      if (row){

         $.ajax({
            url : 'factuur_valideren.php?id='+row.id',  // THIS UPDATES DATA BELONGING TO GRID
            
            success: function(data) {
               $.messager.alert('VALIDEREN ','NR :  '+row.id+' <br> VALIDEREN SUCCES ');
               $('#dg_hvs').datagrid('reload');   // reload the grid and data
            }
      });
         
                     
      }
   }