PDA

View Full Version : EXTJS 4.2: Buffered store with editor grid



navr84
29 Jul 2013, 9:06 PM
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.



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: '[email protected]',
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.

slemmon
31 Jul 2013, 10:52 PM
While a workaround is being discussed internally, I'm afraid insert (CRUD) actions aren't supported with buffered stores in 4.2.x.

Stokes
18 Dec 2013, 10:55 AM
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.

darkorigins
21 Jan 2014, 6:56 AM
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