1. #1
    Sencha User chuckoh's Avatar
    Join Date
    Jan 2012
    Location
    Seoul, Korea
    Posts
    16
    Answers
    1
    Vote Rating
    0
    chuckoh is on a distinguished road

      0  

    Default Unanswered: How to reset Dataview's store data?

    Unanswered: How to reset Dataview's store data?


    Hello guys. looks like a simple thing. But, I couldn't find a solution yet. Please help me.

    I want to know how to reset Dataview's store data.

    First off, my store data configuration is like: (initially, null)

    Code:
    Ext.define('App.view.FilterList', {
        extend: 'Ext.dataview.DataView',
        requires: ['App.view.FilterItem'],
        xtype: 'filter-list',
    
    
        config: {
            cls: 'filter-list',
            store: {
                fields: ['name'],
                data: null,
                sorters: 'name'
            },
            useComponents: true,
            defaultType: 'filter-item'
        }
    });
    On my controller, I insert some data on the fly while running my app like this:

    Code:
    panel.query('filter-list')[0].setData(somedata);
    And, sometime later I want to reset the data to null so I can make the DataView list page blank.

    I tried,

    Code:
        onButtonTap: function(button, event) { // edit button in DataView list
            var listitem = button.getParent();
            var record = listitem.getRecord();
            var storeId = record.stores[0].getStoreId();
            var store = Ext.getStore(storeId);
            store.removeAll();
            :
    I also tried:


    Code:
            var panel = this.getTabPanel();
            var storeId = panel.query('filter-list')[0].getStore().getStoreId();
            var store = Ext.getStore(storeId);
            store.removeAll();
            :

    The list was cleared with the above codes but, I got the following error

    Uncaught TypeError: Cannot call method 'removeCls' of undefined DataView.js:597

    What am I doing wrong? Can anyone suggest a solution for this?


  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,074
    Answers
    3500
    Vote Rating
    854
    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


    It has nothing to do with the store, the error is within dataview. What version of ST2 are you using? I have seen issues where there was a selection and the data was changed causing an error but not sure if this is your issue or not.
    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