Hybrid View

  1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    17
    Answers
    1
    Vote Rating
    0
    Madiyana is on a distinguished road

      0  

    Default 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 :
    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
        });
    My objective is to have a function like :
    function loadstore(link){
    ...
    url: '/gtrte/link/search',
    ...
    } because I want have a dynamic store who change with my value "link"

  2. 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 ..
    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
        });
    Can you tell me the problem please?
    Thank you very much

  3. #2
    Ext JS Premium Member
    Join Date
    Nov 2009
    Location
    St Louis,MO
    Posts
    267
    Answers
    20
    Vote Rating
    18
    James Goddard will become famous soon enough James Goddard will become famous soon enough

      1  

    Default


    Code:
    loadstore: function (link) {
       this.getProxy ().url = 'foo' + link + 'bar';
       this.load ();
    }

  4. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    17
    Answers
    1
    Vote Rating
    0
    Madiyana is on a distinguished road

      0  

    Default


    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 ..
    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
        });
    Can you tell me the problem please?
    Thank you very much

  5. #4
    Sencha User
    Join Date
    Oct 2012
    Posts
    17
    Answers
    1
    Vote Rating
    0
    Madiyana is on a distinguished road

      0  

    Default


    Oups its Oki now...
    I have forgot to add
    url = '' in my Store..
    Thank u for ur help

  6. #5
    Ext JS Premium Member
    Join Date
    Nov 2009
    Location
    St Louis,MO
    Posts
    267
    Answers
    20
    Vote Rating
    18
    James Goddard will become famous soon enough James Goddard will become famous soon enough

      0  

    Default


    Is storeLD01_Objet a global variable? You are not providing any scope to the object.

  7. #6
    Sencha User
    Join Date
    Oct 2012
    Posts
    17
    Answers
    1
    Vote Rating
    0
    Madiyana is on a distinguished road

      0  

    Default


    Yes it is a global variable

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi