1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    8
    Vote Rating
    0
    Lukich is on a distinguished road

      0  

    Default Unanswered: Bug while repopulating the store

    Unanswered: Bug while repopulating the store


    Hello. I have recently been asked to help out on a project that involves Ext JS, so I starting playing around with it and discovered the following bug. Not sure if this is a legitimate bug or just me doing something wrong. Basically, on page load I populate the panel with values and display them. Upon clicking on any of those fields in the view, the store should get emptied out and populated with a new set of values. All the code is listed below. However, once I removeAll() and do add(), even though everything works and view shows new values, I always get this error message:"Uncaught TypeError: Cannot read property 'internalId' of undefined" happening on this line: store.add(newData).
    Any idea what might be causing it? I'm using Ext JS 4. Thank you! Luka
    Code:
    var arrayData = [
        ['Jay Gar','MD'],
        ['Aaron Baker','CA'],
        ['Susan Smith','NY'],
        ['Mary Stein','KT'],
        ['John Zalupic','WA'],
    ];
    
    var store = Ext.create('Ext.data.ArrayStore',{
        data: arrayData,
        fields: ['personName', 'state']
    });
    
    var grid = Ext.create('Ext.grid.Panel', {
        title: 'first grid',
        renderTo: Ext.getBody(),
        authoHeight:true,
        width: 250,
        store: store,
        autoScroll: true,
        columns: [
            { header: 'name', dataIndex: 'personName' },
            { header: 'st', dataIndex: 'state', sortable: false }
        ]
    });
    
    grid.getSelectionModel().on('selectionchange', function(sm, selectedRecord){
        var newData = [
            ['Poka Boka', 'VK'],
            ['Choko Mok', 'CA']
        ];      
    
        store.removeAll();
        store.add(newData);    
    });





  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,798
    Answers
    3467
    Vote Rating
    834
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    I personally don't like ArrayStore but does this give you an error when you add data like this:

    Code:
        var newData = [
            { personName : 'Poka Boka', state : 'VK'},
            { personName : 'Choko Mok', state : 'CA'}
        ];
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Oct 2011
    Posts
    8
    Vote Rating
    0
    Lukich is on a distinguished road

      0  

    Default


    Unfortunately no, I still get the same error. Do you prefer jsonStore to ArrayStore or use some other solution?Thanks!Luka

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,798
    Answers
    3467
    Vote Rating
    834
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    I personally just use a regular Store
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  5. #5
    Sencha User
    Join Date
    Oct 2011
    Posts
    8
    Vote Rating
    0
    Lukich is on a distinguished road

      0  

    Default


    A user at Stackoverflow told me that add method expects records and I feed it an array and suggested I create a set of records to add using store.recordType. Is this a valid point, and if so, what's the Ext 4 version of recordType? I can't find recordType in documentation.

    thank you.

  6. #6
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,798
    Answers
    3467
    Vote Rating
    834
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

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