View Full Version : Populating grid from existing JSON

1 Jun 2007, 10:32 AM
I'm trying to populate a grid from a JSON result set that is returned from AjaxCFC using JQuery.

I thought I could use the Ext.data.MemoryProxy to hold the data returned and then use the JsonReader to get at the values returned but I can't seem to get the grid populated.

What is the best way to do this?

Here is what I'm doing:

url: "/components/products/Group/AttributeManager.cfc", // your CFC
method: methodCall,
data: {},
serialization: "json",
success: function(r){
// create the Data Store
var ds = new Ext.data.Store({
proxy: new Ext.data.MemoryProxy(r),
reader: new Ext.data.JsonReader({
root: 'data',
id: 'product_group_level_id'},
[{name: 'internal', mapping: 'group_internal_label'}]

var colModel = new Ext.grid.ColumnModel([
{header: "Internal Label", width: 120, sortable: true, dataIndex: 'internal'}
var grid = new Ext.grid.Grid('topic-grid', {ds: ds, cm: colModel});

I'm obviously missing something, just not sure what it is.