PDA

View Full Version : Got DirectStore to run, but how do I get it load into my grid?



geewhizbang
30 Jul 2009, 3:56 PM
The function runs now, but I don't understand how to get it to load into my grid, which also renders. A break point set in my server code confirms that the function was called, but I don't understand how to setup the grid to load the data after it is returned from the server.


function ForumInit()
{
if (typeof(KnowledgeBase.gridForumList) != "undefined") return;
Ext.select('div[box^=t]').boxWrap();
gridStore = new Ext.data.DirectStore
(
{
directFn: DirectRequest.GetForumList,
paramsAsHash: false,
paramOrder: '',
sortInfo: { field: 'ForumName', direction: 'ASC' },
idProperty: 'ForumID',
autoLoad: true,
fields:
[
{name: 'ForumID', type: 'string'},
{name: 'ForumName', type: 'string'},
{name: 'CreatedBy', type: 'string'},
{name: 'CreatedDate', type: 'date'},
{name: 'ForumType', type: 'string'},
{name: 'NumberOfPosts', type: 'int'},
{name: 'NumberOfThreads', type: 'int'},
{name: 'ForumCatId', type: 'int'},
{name: 'ModifiedBy', type: 'string'},
{name: 'ModifiedDate', type: 'date'}
],
remoteSort: false
}
);
KnowledgeBase.gridForumList = new Ext.grid.GridPanel
(
{
renderTo: 'divForum',
title: 'Forums',
frame: true,
viewConfig: { autoFill: true },
stripeRows: false,
scroll: false,
autoHeight:true,
autoWidth:true,
sm: new Ext.grid.RowSelectionModel({singleSelect:true}),
store: gridStore,
columns:
[
{header: 'Forum Name', dataIndex: 'ForumName', sortable: true},
{header: 'Created By', dataIndex: 'CreatedBy', width:140,
sortable: true},
{header: 'Created Date', dataIndex: 'CreatedDate', width: 90,
xtype: 'datecolumn', format: 'M d, Y', sortable: true},
{header: 'Type', dataIndex:'ForumType', width:50, sortable: true},
{header: 'Posts', dataIndex:'NumberOfPosts', width:50,
sortable: true},
{header: 'Threads', dataIndex:'NumberOfThreads', width:50,
sortable: true},
{header: 'Category', dataIndex:'ForumCatId', width:100,
sortable: true},
{header: 'Modified By', dataIndex:'ModifiedBy', width:140,
sortable: true},
{header: 'Modified Date', dataIndex:'ModifiedDate', width: 90,
xtype: 'datecolumn', format: 'M d, Y', sortable: true}
]
}
);
}

J@y
31 Jul 2009, 5:53 AM
have you checked what is the result returned from the server?

any screen capture?

geewhizbang
31 Jul 2009, 6:07 AM
I posted this in another location and the problem was determined to be the line
paramOrder: '',

deleting it fixed the problem.

J@y
31 Jul 2009, 6:10 AM
I posted this in another location and the problem was determined to be the line
paramOrder: '',

deleting it fixed the problem.
Yup, becoz you don't have any params passed to the server.