Searching for a Simple Json Grid Example

March 17th, 2010
  • Hi All,

    I'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


  • Awesome, thanks to you both!


  • I am also new but here is a simple example of pulling 2 columns from JSON into a grid. It is pulling the data from an ASP.NET webservice and you will have to adopt your code to make it work.

    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();
    });


  • How about the couple of examples in the tutorial section?







  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about Searching for a Simple Json Grid Example , Please add it free.