PDA

View Full Version : [SOLVED] Why does my RESTful GridPanel not work?



ayqazi
30 Mar 2011, 4:43 AM
Hi,

I'm trying to create a RESTful editable grid, and I can't make it editable. I gets the dta and displays it just fine, but I can't get anything to edit. Can someone have a look at it and tell me what I'm doing wrong?

(NB: I put the Grid into another container, hence the lack of rendering-related configuration.)



var proxy = new Ext.data.HttpProxy({
url: '/pets'
});

var reader = new Ext.data.JsonReader({
totalProperty: 'results',
idProperty: 'id',
root: 'rows',
}, [
{name: 'id'},
{name: 'dob', allowBlank: false},
{name: 'name', allowBlank: false},
]);

var writer = new Ext.data.JsonWriter({
encoding: false
});

var store = new Ext.data.Store({
id: 'pet',
restful: true,
proxy: proxy,
reader: reader,
writer: writer
});

store.load();

var grid = new Ext.grid.GridPanel({
title: 'Pets',
store: store,
region: 'center',
columns: [
{
sortable: true,
dataIndex: 'id',
hidden: true,
header: 'ID',
editor: new Ext.form.TextField({})
},
{
sortable: true,
dataIndex: 'dob',
header: 'Date of Birth',
editor: new Ext.form.TextField({})
},
{
sortable: true,
dataIndex: 'name',
header: 'Name',
read_only: false,
editable: true,
editor: new Ext.form.TextField({})
}

]
});

ayqazi
30 Mar 2011, 4:46 AM
Bah my mistake. Had to use EditorGridPanel.