Searching for a Simple Json Grid Example
March 17th, 2010I'm new to Ext. I'm looking for a very simple example of a grid loaded from Json data. I have looked endlessly and have not found anything....or anything that works. There is an xml example in the samples : http://extjs.com/deploy/dev/examples/grid/xml-grid.html
It would be terrific to see one like this for json but I haven't been able to find one.
I have a php script that renders json from an sql query. I want to drop that into a grid.
Thanks!
Scott
Ext.onReady(function(){
Ext.QuickTips.init();
var fm = Ext.form;
var categoryMap = new Ext.data.Record.create(
[
{name : 'CategoryId'},
{name : 'CategoryName'}
]);
var categoryStore = new Ext.data.Store(
{
proxy: new AspWebServiceProxy(
{
webServiceProxy: Dashboard,
webServiceProxyMethod: Dashboard.GetCategories
}),
reader: new Ext.data.JsonReader({},categoryMap)
});
var categoryModel = new Ext.grid.ColumnModel([
{
id:'CategoryId',
header: "Category ID",
dataIndex: 'CategoryId',
width: 250,
editor: new fm.TextField({
allowBlank: false
})
},{
id:'CategoryName',
header: "CategoryName",
dataIndex: 'CategoryName',
width: 250,
editor: new fm.TextField({
allowBlank: false
})
}
]);
var grid = new Ext.grid.EditorGridPanel({
store: categoryStore,
cm: categoryModel,
renderTo: 'divGrid',
width:600,
height:300,
title:'Test',
frame:true,
clicksToEdit:1
});
categoryStore.load();
});
#If you have any other info about this subject , Please add it free.# |