Results 1 to 2 of 2

Thread: [4.1.1] Grid removeAt error

    Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha User
    Join Date
    Dec 2012
    Posts
    17
    Vote Rating
    0
      0  

    Default [4.1.1] Grid removeAt error

    The test application:
    Code:
    Ext.onReady(function() {
      Ext.create('Ext.container.Viewport', {
        layout: 'border',
        items: [
          {
            region: 'center',
            xtype: 'grid',
            id: 'grid',
            store: Ext.create('Ext.data.Store', {
              fields: [
                {name: 'id', convert: null, defaultValue: undefined},
                {name: 'title', convert: null, defaultValue: undefined}
              ]
            }),
            columns: [
              {
                text: 'ID',
                dataIndex: 'id'
              },
              {
                text: 'Title',
                dataIndex: 'title'
              }
            ]
          },
          {
            region: 'north',
            xtype: 'buttongroup',
            items: [
              {
                text: 'fill grid',
                handler: function () {
                  var grid = Ext.getCmp('grid'), store = grid.getStore();
                  for (var i = 0; i <= 99; i++)
                    store.add({id: i, title: 'title' + i});
                }
              },
              {
                text: 'del rows',
                handler: function () {
                  var grid = Ext.getCmp('grid'), store = grid.getStore();
                  //store.suspendEvents(true);
                  for (var i = 99; i >= 25; i--)
                    store.removeAt(25);
                  //store.resumeEvents();
                }
              }
            ]
          }
        ]
      });
    });
    1) click "fill grid"
    2) click "del rows"
    3) no error

    Now, uncomment "store.suspendEvents(true);" and "store.resumeEvents();"

    1) reload page
    2) click "fill grid"
    3) click "del rows"
    4) error "TypeError: records[i] is undefined"

    -----
    firefox 18.0.1

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    18,392
    Vote Rating
    858
      0  

    Default

    This is resolved in 4.2.0.

    Also, it's fairly poor practice to do this. You would be better to just suspend the events without catching them and refresh the view.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

Posting Permissions

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