PDA

View Full Version : EditorGridPanel doesn't perform update



spaff
20 Dec 2010, 7:21 AM
Hi there, I'm very new to extjs and this is my first try to use ExtJS as frontend for Symfony 1.4.
The Problem is, that the modified data will not be saved after leaving the formfield in EditorGridPanel. The update-event of the store is fired, but there is no request to the update-url of proxy.api.

"loadTasks" is fired by "changeselection" of a treeviewnode, this works fine.



taskGrid = function(viewer, config) {
this.viewer = viewer;
Ext.apply(this, config);

this.store = new Ext.data.Store({
remoteSort: true,
autoSave: true,
proxy: new Ext.data.HttpProxy({
api: {
read : urlLib.task.read,
create : urlLib.task.create,
update: urlLib.task.update,
destroy: urlLib.task.destroy
}
}),
reader: new Ext.data.JsonReader({
root: 'data'
}, [
{name: 'id'},
{name: 'subject', type: 'string', allowBlank: false},
{name: 'description', allowBlank: false},
{name: 'priority', allowBlank: false},
{name: 'due_date', type: 'date', allowBlank: true},
{name: 'done_at', type: 'date', allowBlank: true},
{name: 'category_id', allowBlank: false},
{name: 'author_id', allowBlank: false},
{name: 'created_at', type: 'date', allowBlank: false},
{name: 'updated_at', type: 'date', allowBlank: false},
{name: 'slug', allowBlank: false}
]),
writer: new Ext.data.JsonWriter({
encode: true,
writeAllFields: false
}),
listeners: {
update: function(store, record, operation) {
//
console.log(store);
console.log(record);
console.log(operation);
}
}
});

this.columns = [{
id:'subject',
header: 'Betreff',
sortable: true,
dataIndex: 'subject',
editor: new Ext.form.TextField()
},{
header: 'Prio',
width: 40,
sortable: true,
dataIndex: 'priority'
},{
header: 'Bis',
width: 100,
sortable: true,
dataIndex: 'due_date',
editor: new Ext.form.DateField({
format: 'd.m.Y',
fieldLabel: '',
id: 'due_date',
name: 'due_date',
width:140,
allowBlank:true
}),
renderer: this.formatDate
}];

taskGrid.superclass.constructor.call(this, {
title: 'Aufgaben',
loadMask: true,
autoExpandColumn: 'subject',
autoHeight: true,
border: true,
collapsible: true
});
}

Ext.extend(taskGrid, Ext.grid.EditorGridPanel, {
loadTasks: function(categoryId) {
this.store.baseParams = {
categoryId: categoryId
};
this.store.load();
},
formatDate: function (date){
return date ? date.dateFormat('d.m.Y') : '';
}
});

Ext.reg('apptaskgrid', taskGrid);

spaff
21 Dec 2010, 2:58 PM
don't know why, but it works again... (:|