Hybrid View
-
14 Nov 2012 3:28 AM #1
Answered: Store in a function
Answered: Store in a function
Hi,
I am a new user in ExtJS4 and I have a problem that i can't resolve..
I wanna put in a function this code :
My objective is to have a function like :Code:var storeLD01_Objet = Ext.create('Ext.data.Store', { fields :['id', 'libelle'], labelWidth :150, proxy: { type: 'ajax', url: '/value/TypeAmenrecherche/search', reader: { type: 'json', root: 'elt' } }, listeners: { 'load': function(store, operation, options){ this.insert(0, {id:'--', libelle:'--'}); } }, autoLoad: true });
function loadstore(link){
...
url: '/gtrte/link/search',
...
} because I want have a dynamic store who change with my value "link"
-
Best Answer Posted by Madiyana
Thank's.. It'is work now but when i used i can't do a selection in my combobox and i don't know why ..
Can you tell me the problem please?Code:var LD00_Nature = Ext.create('Ext.form.ComboBox', { id :'nature', fieldLabel :'Nature', labelWidth :80, store: storeLD00_Nature, queryMode :'remote', displayField :'libelle', valueField :'libelle', emptyText :'--', editable :false, listeners : { select : function(liste, index){ if(liste.value=='Amenagement'){ storeLD01_Objet.getProxy ().url = '/gedeo/TypeAmenagement/recherche/', storeLD01_Objet.load (); } if(liste.value=='Milieu'){ storeLD01_Objet.getProxy ().url = '/gedeo/TypeMilieu/recherche/', storeLD01_Objet.load (); } } }, border: 1 }); var storeLD01_Objet = Ext.create('Ext.data.Store', { fields :['id', 'libelle'], labelWidth :150, proxy: { type: 'ajax', reader: { type: 'json', root: 'elt' } }, listeners: { 'load': function(store, operation, options){ this.insert(0, {id:'--', libelle:'--'}); } }, autoLoad: true });
Thank you very much
-
14 Nov 2012 6:04 AM #2
Code:loadstore: function (link) { this.getProxy ().url = 'foo' + link + 'bar'; this.load (); }
-
14 Nov 2012 6:16 AM #3
Thank's.. It'is work now but when i used i can't do a selection in my combobox and i don't know why ..
Can you tell me the problem please?Code:var LD00_Nature = Ext.create('Ext.form.ComboBox', { id :'nature', fieldLabel :'Nature', labelWidth :80, store: storeLD00_Nature, queryMode :'remote', displayField :'libelle', valueField :'libelle', emptyText :'--', editable :false, listeners : { select : function(liste, index){ if(liste.value=='Amenagement'){ storeLD01_Objet.getProxy ().url = '/gedeo/TypeAmenagement/recherche/', storeLD01_Objet.load (); } if(liste.value=='Milieu'){ storeLD01_Objet.getProxy ().url = '/gedeo/TypeMilieu/recherche/', storeLD01_Objet.load (); } } }, border: 1 }); var storeLD01_Objet = Ext.create('Ext.data.Store', { fields :['id', 'libelle'], labelWidth :150, proxy: { type: 'ajax', reader: { type: 'json', root: 'elt' } }, listeners: { 'load': function(store, operation, options){ this.insert(0, {id:'--', libelle:'--'}); } }, autoLoad: true });
Thank you very much
-
14 Nov 2012 6:19 AM #4
Oups its Oki now...
I have forgot to add
url = '' in my Store..
Thank u for ur help
-
14 Nov 2012 6:21 AM #5
Is storeLD01_Objet a global variable? You are not providing any scope to the object.
-
14 Nov 2012 6:32 AM #6


Reply With Quote