Hello.
I want to update my ExtJS grid using Ext.form.FormPanel.
Unfortunately my form doesn't update the grid.
This is the code I send data from the FormPanel:
Code:
handler: function() {
var form = this.up('form').getForm();
var formData = Ext.encode(form.getValues());
var received = function (response) {
x = Ext.decode( response.responseText );
console.log(this);
}
Ext.Ajax.request({
url: '/ajax/index/extjsaction/update',
method: 'POST',
headers: {'Content-Type': 'text/html'},
waitTitle: 'Connecting',
waitMsg: 'Sending data...',
jsonData: {
sectors: formData
},
success: received,
failure: function(){console.log('failure');}
});
After submitting In console I can see and It doesn't update the grid:
POST tab:
Code:
JSON
sectors "{\"sectorid\":\"12\",\"sectorbg\":\"ico43\",\"lastactualizedate\":\"2012-06-20\",\"picture\":\"c14b9d287a06bcb9eeba23b153bbb6fd.png\",\"dispno\":\"12\",\"site_link\":\"\",\"target_blank\":\"13\"}"
When I update the grid using Ext.grid.plugin.CellEditing my POST data looks another and it works:
POST tab:
Code:
Parameters application/x-www-form-urlencoded
sectors {"sectorid":12,"sectorbg":"ico48","lastactualizedate":"2012-06-20","picture":"c14b9d287a06bcb9eeba23b153bbb6fd.png","dispno":12,"site_link":"","target_blank":1,"id":null}
My proxy code:
Code:
var store = new Ext.data.Store({
autoLoad: true,
autoSync: false, // указание на автосохранения в хранилище
model: 'Sectors',
pageSize: 10, // ОБЯЗАТЕЛЬНО В ХРАНИЛИЩЕ store!!!
remoteSort: true,
disableCaching : true,
proxy: {
type: 'ajax',
api: {
read: '/ajax/index/extjsaction/read',
update: '/ajax/index/extjsaction/update',
create: '/ajax/index/extjsaction/create',
destroy: '/ajax/index/extjsaction/destroy'
},
reader: {
type: 'json',
root: 'sectors',
totalProperty: 'total'
},
writer: {
type: 'json',
root: 'sectors',
totalProperty: 'total',
encode: true
}
}
});
Please help. I am new in ExtJS and I think I lost some important detail here.