zurik44
3 May 2007, 4:09 PM
Hello fellow Ext Guru's, I have a little issue where my data is not loading into my grid. This is my first attempt at using the grid I'm going to attach as much info as I can but if I leave anything out please post what I need to send you to help troubleshoot my issue.
The following is the code for loading my grid.
<script language="javascript">
Ext.onReady(function(){
// create the Data Store
var ds = new Ext.data.Store({
// load using script tags for cross domain, if the data in on the same domain as
// this page, an HttpProxy would be better
proxy: new Ext.data.HttpProxy({
url: '/administrator/userManager/ajax.userlist.cfm'
}),
// create reader that reads the Topic records
reader: new Ext.data.JsonReader({
root: 'DATA',
id: 'ID'
}, [
{name: 'ID', mapping: 'ID'},
{name: 'First Name', mapping: 'FIRSTNAME'},
{name: 'Last Name', mapping: 'LASTNAME'},
{name: 'Username', mapping: 'USERNAME'},
]),
// turn on remote sorting
//remoteSort: true
});
//ds.setDefaultSort('LASTNAME', 'asc');
ds.load();
// custom or reusable ColumnModels
var colModel = new Ext.grid.ColumnModel([
{header: "ID", width: 25, sortable: true, locked:false, dataIndex: 'ID'},
{header: "Firs Name", width: 75, sortable: true, dataIndex: 'FIRSTNAME'},
{header: "Last Name", width: 75, sortable: true, dataIndex: 'LASTNAME'},
{header: "Username", width: 85, sortable: true, dataIndex: 'USERNAME'}
]);
// create the Grid
var grid = new Ext.grid.Grid('user-grid', {
ds: ds,
cm: colModel,
});
grid.render();
});
</script>
As you can see it's pretty text book.
My ajax.userlist.cfm file is pretty simple. The output of the file is below. I am using the JSONEncode UDF from Cflib.org to convert my query to a JSON String.
{"RECORDCOUNT":3,"COLUMNLIST":"FIRSTNAME,ID,LASTNAME,USERNAME,UUID","DATA":{"FIRSTNAME":["Marco","Guest","Developer"],"ID":[1,2,6],"LASTNAME":["Williams","Account","Developer"],"USERNAME":["admin","guest","dev"],"UUID":["171C6E58-BCD6-41DB-F9A60055B09C5FE0","171DEDE3-BCD6-41DB-F6AA30EE46189D95","1745385C-BCD6-41DB-FDCD9A738A6FE065"]}}
Attached are firebug screen shots to aid in your evaluation of my issue.
This is all i get in my grid :(
http://beta.bluapple.net/images/griderror.jpg
I'm no expert, however I do think this is a very strait forward "example" I just don't understand what I'm doing wrong.
Any help would be great!
Thanks,
Marco ( a.k.a Zurik )
The following is the code for loading my grid.
<script language="javascript">
Ext.onReady(function(){
// create the Data Store
var ds = new Ext.data.Store({
// load using script tags for cross domain, if the data in on the same domain as
// this page, an HttpProxy would be better
proxy: new Ext.data.HttpProxy({
url: '/administrator/userManager/ajax.userlist.cfm'
}),
// create reader that reads the Topic records
reader: new Ext.data.JsonReader({
root: 'DATA',
id: 'ID'
}, [
{name: 'ID', mapping: 'ID'},
{name: 'First Name', mapping: 'FIRSTNAME'},
{name: 'Last Name', mapping: 'LASTNAME'},
{name: 'Username', mapping: 'USERNAME'},
]),
// turn on remote sorting
//remoteSort: true
});
//ds.setDefaultSort('LASTNAME', 'asc');
ds.load();
// custom or reusable ColumnModels
var colModel = new Ext.grid.ColumnModel([
{header: "ID", width: 25, sortable: true, locked:false, dataIndex: 'ID'},
{header: "Firs Name", width: 75, sortable: true, dataIndex: 'FIRSTNAME'},
{header: "Last Name", width: 75, sortable: true, dataIndex: 'LASTNAME'},
{header: "Username", width: 85, sortable: true, dataIndex: 'USERNAME'}
]);
// create the Grid
var grid = new Ext.grid.Grid('user-grid', {
ds: ds,
cm: colModel,
});
grid.render();
});
</script>
As you can see it's pretty text book.
My ajax.userlist.cfm file is pretty simple. The output of the file is below. I am using the JSONEncode UDF from Cflib.org to convert my query to a JSON String.
{"RECORDCOUNT":3,"COLUMNLIST":"FIRSTNAME,ID,LASTNAME,USERNAME,UUID","DATA":{"FIRSTNAME":["Marco","Guest","Developer"],"ID":[1,2,6],"LASTNAME":["Williams","Account","Developer"],"USERNAME":["admin","guest","dev"],"UUID":["171C6E58-BCD6-41DB-F9A60055B09C5FE0","171DEDE3-BCD6-41DB-F6AA30EE46189D95","1745385C-BCD6-41DB-FDCD9A738A6FE065"]}}
Attached are firebug screen shots to aid in your evaluation of my issue.
This is all i get in my grid :(
http://beta.bluapple.net/images/griderror.jpg
I'm no expert, however I do think this is a very strait forward "example" I just don't understand what I'm doing wrong.
Any help would be great!
Thanks,
Marco ( a.k.a Zurik )