Results 1 to 2 of 2

Thread: How to reset Dataview's store data?

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

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,551
    Answers
    3931
    Vote Rating
    1271
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •