I have a greed with columns. And have a jsp which do json data. im jet this json in my js and do Ext.data.JsonStore but its not getting in columns.
store
store = new Ext.data.JsonStore({
url: url_servlet+'Kadastr.jsp',
fields: [
{name: 'indoor', type: 'bool'},
{name: 'kad_id', type: 'integer'},
{name: 'kad_name',type: 'string'}
]
});
store.load();
columns
var cm = new Ext.grid.ColumnModel({
columns: [{
xtype: 'checkcolumn',
header: '',
dataIndex: 'indoor',
width: 50
}, {
header: 'id',
dataIndex: 'kad_id',
width: 70
},{
id: 'kad_name',
header: 'Участок',
dataIndex: 'common',
width: 130,
}]
})
gridpanel
var kad_tab = new Ext.grid.GridPanel({
store: store,
cm: cm,
id: 'kad_greed',
title:'Список Участков',
autoScroll: true,
java code
JSONObject resultJson = new JSONObject();
resultJson.put("indoor",new Boolean(false));
resultJson.put("kad_name",fileName);
resultJson.put("kad_id",new Integer(fileId));
out.println(resultJson.toString());
Any idias? what can i foggoten to add?
The store reader expects an array of items, as i see you are sending just one record.
so instead of :
{"indoor":false,"kad_name":"filename"..}you should send an array and a root object. Something like:{"values":[{"indoor":false,"kad_name":"filename"..}]}and then just add root “values” to the jsonreader. Default root is “” so you can send it with default blank.