1. #1
    Sencha User
    Join Date
    Jan 2012
    Posts
    63
    Answers
    2
    Vote Rating
    0
    prakashkadakol is on a distinguished road

      0  

    Default Unanswered: store accessibility

    Unanswered: store accessibility


    In below code am not able to access the store2 in display function tried with "this" "global" but fail to access the store2,am just creating copy of original store with store2 in insert function origional store will be get changed by filter so wanted to access origional store again in display function,Any idea or suggestions for this

    insert: function(){
    var store = this.panel.getStore();
    var records1 = [];
    store.each(function(r){
    records1.push(r.copy());
    });
    var store2 = new Ext.data.Store({
    recordType: store.recordType
    });
    }


    display: function()
    { //How i can access the store2 here }

  2. #2
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,088
    Answers
    112
    Vote Rating
    95
    Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light

      0  

    Default


    you can create store2 variable on a global scope (outside the insert function).

    Code:
    var store2;
    
    insert: function(){
      store2 = new Ext.data.Store....
    }
    
    display: function() {
      // store2 is now accessible here
    }
    or assign a storeId to store2 and use that to access it.

  3. #3
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,333
    Answers
    124
    Vote Rating
    85
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      0  

    Default Make custom config to your store2 variable

    Make custom config to your store2 variable


    hi prakashkadakol,

    Try this one
    Code:
    insert: function(){ var store = this.panel.getStore() , records1 = []; store.each(function(r){ records1.push(r.copy()); }); this.store2 = new Ext.data.Store({ recordType: store.recordType }); } display: function(){ var data = this.store2; ............ }
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

Thread Participants: 2

Tags for this Thread