Results 1 to 6 of 6

Thread: Setting a null store on a grid doesn't trigger a refresh

    Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-21335 in 6.5.0.775.
  1. #1
    Sencha Premium Member
    Join Date
    Oct 2011
    Location
    Duluth, MN
    Posts
    154

    Default Setting a null store on a grid doesn't trigger a refresh

    If I have a reference to a record in a viewModel, and I set it to null, the controls that are bound to the fields in the record keep showing the data. If I set the reference to a new record the view is blanked out appropriately.

    Thanks
    Bob

  2. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,241

    Default

    Please post a test case:

    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  3. #3
    Sencha Premium Member
    Join Date
    Oct 2011
    Location
    Duluth, MN
    Posts
    154

    Default

    Apparently I can't reproduce it in fiddle. It's happening both on text boxes and grids set to an association on a record. I have a bad workaround where I set the record to an empty record ( MyModel.create()), and then set it to null afterwards. This is obviously not optimal. I'm using version 6.0.1.250 modern. ThanksBob

  4. #4
    Sencha Premium Member
    Join Date
    Oct 2011
    Location
    Duluth, MN
    Posts
    154

    Default

    I was able to reproduce the grid example..

    https://fiddle.sencha.com/#fiddle/1auq

    Thanks


  5. #5
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,241

    Default

    I can confirm there's a bug here, but it's not related to viewmodels/binding. The grid isn't refreshing correctly when updated with a null store:

    Code:
    Ext.application({
        name: 'Foo',
    
        launch: function() {
            Ext.Viewport.add({
                items: [{
                    xtype: 'button',
                    text: 'Clear',
                    handler: function() {
                        Ext.getCmp('foo').setStore(null);
                    }
                }, {
                    xtype: 'grid',
                    id: 'foo',
                    height: 200,
                    store: {
                        fields: ['name'],
                        data: [{
                            name: 'Foo'
                        }]
                    },
                    columns: [{
                        dataIndex: 'name',
                        flex: 1
                    }]
    
                }]
            });
        }
    });
    The viewmodel behaves correctly and ends up setting a null store on the grid as it should.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  6. #6

    Default

    I've just hit this problem in the application I'm writing. This is absolutely crucial in converting from Flex to ExtJS. I'm really just learning ExtJS6 so apologies if this is obvious but is there a workaround to force the grid to display no rows?

Similar Threads

  1. Delete item in store doesn't refresh Grid
    By srajakumar in forum Ext 5: Q&A
    Replies: 12
    Last Post: 9 Jun 2015, 7:15 AM
  2. [FIXED] features summary in a grid doesn't refresh on store reload
    By w3c2i in forum Ext 5: Bugs
    Replies: 5
    Last Post: 31 Dec 2014, 2:06 AM
  3. Replies: 1
    Last Post: 2 Oct 2013, 6:39 AM
  4. Grid doesn't refresh it's content, after changing data in it's store
    By Surgeon in forum Ext 2.x: Help & Discussion
    Replies: 8
    Last Post: 4 Dec 2008, 11:44 AM

Posting Permissions

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