PDA

View Full Version : Grid not sending updates to server



wcoykendall
20 Feb 2012, 10:52 AM
Not sure what I am doing wrong, can anyone shed some light as to why the PHP script does not receive anything other than _DC?

var myData = Ext.create('Ext.data.Store', {
storeId:'tableStore',
autoLoad: true,
autoSync: true,
model: 'DataTable',
groupField: 'table',
pageSize: 12,
proxy: {
type: 'ajax',
url : 'getfields.php',
api: {
read : 'getfields.php',
create : 'getfields.php',
update: 'getfields.php',
destroy: 'getfields.php'
},
reader: {
type: 'json',
root: 'items',
totalProperty: 'total'
},
writer: {
type: 'json',
encode: true,
root: 'data'
}
}
});

Ext.create('Ext.grid.Panel', {
title: 'Customer Records',
store: myData,
columns: [
{ header: 'ID', dataIndex: 'id'},
{ header: 'Table', dataIndex: 'mtable',editor: { xtype: 'textfield', allowBlank: true}, flex: 1 },
{ header: 'Column', dataIndex: 'mcolumn', editor: 'textfield'},
{ header: 'Data Type', dataIndex: 'mdatatype', editor: 'textfield' },
{ header: 'Length', dataIndex: 'mlength', editor: 'numberfield'},
],
selType: 'rowmodel',
plugins: [
Ext.create('Ext.grid.plugin.RowEditing', {
clicksToEdit: 1
})
],
dockedItems: [{
xtype: 'pagingtoolbar',
store: myData, // same store GridPanel is using
dock: 'bottom',
displayInfo: true
}],
width: 500,
renderTo: 'grid-example'
});

masoud_tamizy
20 Feb 2012, 11:05 AM
remove : "url : 'getfields.php',"
or
api: {
read : 'getfields.php',
create : 'getfields.php',
update: 'getfields.php',
destroy: 'getfields.php'
},

wcoykendall
20 Feb 2012, 11:25 AM
Ok, I added API after the url didn't do it, and I removed the URL and same results, server gets called with just _dc in the URL but no post information. I re-added URL and removed API and same results, not sure what is incorrect.

My data model looks like this:
Ext.define('DataTable', {
extend: 'Ext.data.Model',
fields: [
{name: 'id', type: 'string'},
{name: 'mtable', type:'string'},
{name: 'mcolumn', type: 'string'},
{name: 'mdatatype', type: 'string'},
{name: 'mlength', type: 'int'}
]
});

masoud_tamizy
20 Feb 2012, 11:39 AM
do you use row-editing or cell-editing or another plugin ?

wcoykendall
20 Feb 2012, 12:04 PM
I am using RowEditing

wcoykendall
21 Feb 2012, 8:17 PM
Changing type to rest and it to works.

type: 'rest',