-
24 Feb 2008 1:59 AM #1
[2.x] Ext.denkoo.fewQuery : Only One AJax Request=>many DataStore For loading COMBO
[2.x] Ext.denkoo.fewQuery : Only One AJax Request=>many DataStore For loading COMBO
Hi,
I'm beginer on Ext Developpement, so My code is not perfect... sorry ))
This Ext can populate 10,20 or 30 combos on your form with only one AjaxQuery
A listener of AjaxRequest populate datastore of each COMBO.
Syntaxe for init the Ajax Request :
and for each COMBO :PHP Code:Ext.ux.denkoo.fewQuery.init(); // RAZ
// param in add method => add (idDS, "Task to ask data server","table bdd", Objet config transmit to server by POST)
Ext.ux.denkoo.fewQuery.add("society","listLoad","societyTable",{select :"idtiers, denomination", sort: "denomination", dir: "ASC"});
Ext.ux.denkoo.fewQuery.add("fonction","listLoad","fonctionTable",{select :"idtiersFonction", sort: "idtiersFonction", dir: "ASC"});
Ext.ux.denkoo.fewQuery.add("unite","listLoad","uniteTable",{select :"unite", sort: "unite", dir: "ASC"});
Ext.ux.denkoo.fewQuery.load();
Full online example :PHP Code:// param in getDs method => getDs (idDS)
store: Ext.ux.denkoo.fewQuery.getDs("society"),
http://213.251.166.160/~extjs/examples/fewQuery/fewquery.htm
Denkoo
-
24 Feb 2008 6:30 AM #2
What happens if data in the underlying table changes - do I need to reload all stores or can I do it on per-store basis?
Jozef Sakalos, aka Saki
A lot of valuable info at:
Saki's Extensions and Plugins
Saki's Extensions and Plugins Docs
Saki's Examples, Latest: Grid in Card Layout
Saki's Blog, Featured: Writing a Big Application in Ext, Latest: Grid MultiSearch Plugin Video
-
24 Feb 2008 8:14 AM #3
you can do it on per-store basis
you can do it on per-store basis
this Extension do :
0. with method this.init() => RAZ all data and dataStore
1. with method this.add(config)
=> collect all your requests... and affect on each an ID (idQuery)
=> create Ext.data.simpleStore with
data: this.myEmptyArray,
fields: Ext.decode(myConfigParamSELECT)
3. when you use method this.load()=>
=> generate only one requete => send it to server width Ajax
=> listener : load
+ responseText=>parse DATA=>populate this.myEmptyArray (in data.simpleStore)
Note: method this.getDs( idQuery )=>get Datastore width this idQuery
**********************************
So it's real Ext.data.simpleStore... you make all operation you doing with data.simpleStore habitualy ))
thanks for your Post and I will be please if you find some interest on this Extension when I see all your contribute ))
gratz
denkoo
-
24 Feb 2008 8:29 AM #4
nota... this Extension debug another problem
nota... this Extension debug another problem
When I populate my forms, randomely, Combo not display displayField, but valueField only. I refresh and sometime it's Ok, other time, not...
With this extension, I'm not constat this problem... It's the pleasant gift will make me great surprise )
force be with you )
-
24 Feb 2008 9:03 AM #5
Well, I still don't know... If I use my server database in multiuser environment it can happen, and it happens, that another user changes data in the table that is used as row source for a combo.
Now, I need to reload the combo's store to get fresh data. The question is if I can reload only one store this extension keeps or if I need to reload all stores for all combos?Jozef Sakalos, aka Saki
A lot of valuable info at:
Saki's Extensions and Plugins
Saki's Extensions and Plugins Docs
Saki's Examples, Latest: Grid in Card Layout
Saki's Blog, Featured: Writing a Big Application in Ext, Latest: Grid MultiSearch Plugin Video
-
24 Feb 2008 4:36 PM #6
No.... but now it's ok )) => v0.2
No.... but now it's ok )) => v0.2
Sure, I have only "fields" and "data" parameter on my datastore, so you can't call load or reload on it !
So, i create method reload, for doing that (v0.2):
see the demo in online version :
http://213.251.166.160/~extjs/examples/fewQuery0.2/fewquery.htm
roadmap:PHP Code:Ext.ux.denkoo.fewQuery.reload("unite"); // for reloding dataStore 'unite'
Ext.ux.denkoo.fewQuery.reload("society", "fonction"); // for reloding dataStore 'society' and 'fonction' width only one request
=> choice type of datastore (grouping, json... with affected URL for reloading independantly [usefull on datagrid])
=> integrated link betwen 2 combos (listener metod + filter)
-
24 Feb 2008 5:01 PM #7
Hmmm,
if there are only fields and data you can just create static arrays available on page load. Something like this:
This solution is suitable only for static data (data that change very rarely) and for stores with only a few records. With this setup you need 0 extra client/server round trips and you can be sure that data is available before you try to combo.setValue().PHP Code:<script type="text/javascript">
MyScope.store1data = {
fields:[ .... ]
,data:[ .... ]
};
MyScope.store2data = {
fields:[ .... ]
,data:[ .... ]
};
</script>
Jozef Sakalos, aka Saki
A lot of valuable info at:
Saki's Extensions and Plugins
Saki's Extensions and Plugins Docs
Saki's Examples, Latest: Grid in Card Layout
Saki's Blog, Featured: Writing a Big Application in Ext, Latest: Grid MultiSearch Plugin Video


Reply With Quote