-
1 Apr 2009 1:39 PM #1
how to show a wait message while calling store load
how to show a wait message while calling store load
Hi all,
i have an Ext.data.Store object and i am calling "load()" function manually.
How can i show a wait message while load operation running
var myDataStore = new Ext.data.Store(){....} ;
myDataStore.load(); --> at this time i want to show a wait message on page.
-
1 Apr 2009 1:45 PM #2
function showProgress(){
Ext.MessageBox.show({
msg: 'Saving your data, please wait...',
progressText: 'Saving...',
width:300,
wait:true,
waitConfig: {interval:200}, icon:'ext-mb-download'
-
1 Apr 2009 1:51 PM #3
i could not get how to show the message.
when and how should i call the showProgress function?
(the message on the screen must disappear automatically.)
-
2 Apr 2009 4:33 AM #4
is not there a solution for that if i use "load"?
-
2 Apr 2009 4:36 AM #5
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
14 Jan 2010 5:48 AM #6
-
22 Jun 2010 5:25 AM #7
Just for completeness in this thread (and to help people searching, like me!) I will explain it a little more!
You first need to create your Ext.LoadMask object. This will contain the message msg: you wish to display.
If you are using a Store, you can specify the store: that you want to bind the LoadMask to, and everything then happens automagically.
You can see that we create a data definition first "dataDef" which is used to define the structure of the data received by the JSONReader "readerData".Code:var dataDef = Ext.data.Record.create([{name:'id'},{name:'item_value',mapping:'item.price'}]);var readerData =new Ext.data.JsonReader({idProperty:'id',root:'results'}, dataDef);var storeData =new Ext.data.Store({nocache:true,reader: readerData,autoLoad:false,remoteSort:false,proxy:new Ext.data.HttpProxy({url:'http://server/dir/file',method:'POST'}),listeners:{load:function(self, records, options){doSomething(self.getAt(0).get('item_value'));},exception:function(self, type, action, request, response){Ext.Msg.alert('Load Error!','ooops!');}}});// loading mask for this Storevar mask =new Ext.LoadMask(Ext.getBody(),{msg:'Loading data...', store: storeData});
Then we create a Store "storeData" to hold this data in, and give it the Reader "readerData" so it knows how to interpret the data it receives. I've added in a Load and Exception event, just to give a more complete example.
Finally, we create our LoadMask "mask" and as part of the parameters we can bind it to the store: storeData.
Now when the store is loading, it will automatically display the LoadingMask.
HTH!


Reply With Quote
my ext js site