I'm currently in the process of updating an application to ExtJS 5, and I'm encountering difficulties with getting a grid that uses RowEditing to send edited records back to the server via POST.
Ext.define("MyRecordDef", { extend: "Ext.data.Model" });
var MyEditor = Ext.create('Ext.grid.plugin.RowEditing', { clicksToEdit: 1 });
var MyStore = new Ext.data.Store({
model: "MyRecordDef",
autoSync: true,
proxy: {
type: "ajax",
url: "ajaxurl.aspx",
batchActions: false,
extraParams: { Command: 'Save' },
reader: { type: "json", rootProperty: "rows" },
writer: { type: "json", encode: true, writeAllFields: true }
}
});
var MyGrid = new Ext.grid.GridPanel({
store: MyStore,
plugins: [ MyEditor ],
columns: [
{
id: "fieldtoedit",
dataIndex: "fieldtoedit",
editor: new Ext.form.NumberField()
}
]
});
Although the row editor pops up, allows me to change values, and click the Update button, unfortunately no action occurs. There is no request sent and no errors appearing in the console.
In an attempt to troubleshoot, I added the following:
MyGrid.on('edit', function (e) {
alert('You are Editing ' + e.context.record.id);
MyStore.sync(); // trying to trigger a sync manually
});
Despite receiving the correct record number in the alert, there is still no AJAX request being made. It seems as if ExtJS is completely disregarding the writer configuration.
Since I don't have separate endpoints for each CRUD operation, I am relying on the url
instead of utilizing the api
config option.