PDA

View Full Version : How can I delay a Grid from loading, even after the associated store is loaded...



khushboo_nf
28 Nov 2013, 11:54 AM
I am loading a Store associated with a Grid through a Combobox on the same Form Panel where the Grid is linked. But I need to delay the grid from loading and displaying the data, before I perform some other Ajax operations.. How can I prevent the loading of this Grid on the same Form Panel for a defined period/operation?
I am using MVC format of ExtJs4

scottmartin
28 Nov 2013, 5:40 PM
You can use JS :: setTimeout to delay an action

setTimeout(function(){
// this will be performed in 2 seconds
},2000);

khushboo_nf
28 Nov 2013, 10:56 PM
:(


var flag = false;


setTimeout(function(){
flag = true;
// this will be performed in 2 seconds
},10000);
if(!flag)
return 'invalid';
else
return 'valid';


It is still returning flag = 'false' through return statement return 'invalid';
Is there any way to make this whole operation in sync . So that return should execute after timeout function.

scottmartin
29 Nov 2013, 11:48 AM
That is because the code is still continuing to process. SetTimeout does not halt the application. If you check the value inside the function, then you will see in your case, 10 seconds later, flag will be true.

You would put your ajax call inside here, then 10 seconds later it would make the call.