Results 1 to 4 of 4

Thread: EXTJS 4.2: Buffered store with editor grid

  1. #1
    Sencha User
    Join Date
    Apr 2011
    Posts
    15

    Default EXTJS 4.2: Buffered store with editor grid

    Buffered Store with editor grid.We have been using version 4.1.1 and are migrating to 4.2.0.663. We have editor grids with buffered stores which contain large volume of data. The editor grids are similar to the row-editing example(except that it uses buffered store). But the add functionality for the grid has stopped after migration and it raises an error
    Ext.Error: insert operation not supported into buffered Store.

    HTML Code:
    var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
            clicksToMoveEditor: 1,
            autoCancel: false
        });
    // create the grid and specify what field you want
    // to use for the editor at each column.
    var grid = Ext.create('Ext.grid.Panel', {
        store: store,
        columns: [{
            header: 'Name',
            dataIndex: 'name',
            flex: 1,
            editor: {
                // defaults to textfield if no xtype is supplied
                allowBlank: false
            }
        }, {
            header: 'Email',
            dataIndex: 'email',
            width: 160,
            editor: {
                allowBlank: false,
                vtype: 'email'
            }
        }, {
            xtype: 'datecolumn',
            header: 'Start Date',
            dataIndex: 'start',
            width: 90,
            editor: {
                xtype: 'datefield',
                allowBlank: false,
                format: 'm/d/Y',
                minValue: '01/01/2006',
                minText: 'Cannot have a start date before the company existed!',
                maxValue: Ext.Date.format(new Date(), 'm/d/Y')
            }
        }, {
            xtype: 'numbercolumn',
            header: 'Salary',
            dataIndex: 'salary',
            format: '$0,0',
            width: 90,
            editor: {
                xtype: 'numberfield',
                allowBlank: false,
                minValue: 1,
                maxValue: 150000
            }
        }, {
            xtype: 'checkcolumn',
            header: 'Active?',
            dataIndex: 'active',
            width: 60,
            editor: {
                xtype: 'checkbox',
                cls: 'x-grid-checkheader-editor'
            }
        }],
        renderTo: 'editor-grid',
        width: 600,
        height: 400,
        title: 'Employee Salaries',
        frame: true,
        tbar: [{
            text: 'Add Employee',
            iconCls: 'employee-add',
            handler : function() {
                rowEditing.cancelEdit();
    
                // Create a model instance
                var r = Ext.create('Employee', {
                    name: 'New Guy',
                    email: 'new@sencha-test.com',
                    start: Ext.Date.clearTime(new Date()),
                    salary: 50000,
                    active: true
                });
    
                store.insert(0, r);
                rowEditing.startEdit(0, 0);
            }
        }],
        plugins: [rowEditing],
    });
    Please advise on what is the approach to be followed.

  2. #2
    Sencha User slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    6,165
    Answers
    505

    Default

    While a workaround is being discussed internally, I'm afraid insert (CRUD) actions aren't supported with buffered stores in 4.2.x.

  3. #3
    Sencha Premium Member
    Join Date
    Jul 2011
    Posts
    17

    Default

    Quote Originally Posted by slemmon View Post
    While a workaround is being discussed internally, I'm afraid insert (CRUD) actions aren't supported with buffered stores in 4.2.x.
    Yikes. That seems like a huge regression.

    Before, if you had a buffered store with a million records, you could insert a record and then sync() and it would work fine. Why prevent that now?

    Stokes.

  4. #4
    Sencha Premium Member
    Join Date
    Jan 2013
    Location
    London
    Posts
    84

    Default

    Any update on this?

    This does explain why we're seeing errors like the following after trying to edit a record using the Row Editing on a Grid backed by a Buffered CRUD Direct Store;

    Ext.Error: getById called for ID that is not present in local cache
    14:15:10.300 "[E] Ext.data.Store.getById(): getById called for ID that is not present in local cache"


    Not being able to use CRUD API on a buffered store effectively makes the buffered store unusable/read only for us, as nearly all of our code utilizes CRUD on to Direct Stores.


    On a side note - Cant actually find reference in the docs to anything that says "dont use buffering with CRUD".

    Mark

Posting Permissions

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