PDA

View Full Version : Using Ext.Direct with GroupingStore help needed



geewhizbang
7 Aug 2009, 11:25 PM
I don't get what I'm doing wrong yet with grouping store. The data is coming back, i can see 3 records

It appears that something is not right with totalProperty, but I don't have a total property. I don't know wny this can't notice that there are three rows in the array and use them.

However, the grid data has only one row instead of the 3 in the jsonData.



Ext.encode(KnowledgeBase.Forum.ForumListStore.reader.jsonData)
[{"LastPostTopic":"My Aunt","LastPostBy":"KBAdmin,KBAdmin","LastPostDate":"1-01-01T00:00:00","LastPostThreadId":1,"Posts":0,"ForumID":0,"ForumName":"Anteater","ForumType":0,"CatID":1,"CreatedBy":"KBAdmin,KBAdmin","ModifiedBy":"","ModifiedDate":"1-01-01T00:00:00","CreatedDate":"2009-08-04T13:33:05","NumberOfThreads":1,"NumberOfPosts":3,"CatName":"Animals"},{"LastPostTopic":"Which is this","LastPostBy":"KBAdmin,KBAdmin","LastPostDate":"1-01-01T00:00:00","LastPostThreadId":2,"Posts":0,"ForumID":0,"ForumName":"Management","ForumType":0,"CatID":1,"CreatedBy":"KBAdmin,KBAdmin","ModifiedBy":"","ModifiedDate":"1-01-01T00:00:00","CreatedDate":"2009-08-04T13:48:13","NumberOfThreads":2,"NumberOfPosts":3,"CatName":"Animals"},{"LastPostTopic":"Geeesh","LastPostBy":"KBAdmin,KBAdmin","LastPostDate":"1-01-01T00:00:00","LastPostThreadId":8,"Posts":0,"ForumID":0,"ForumName":"Strange and Peculiar","ForumType":0,"CatID":1,"CreatedBy":"KBAdmin,KBAdmin","ModifiedBy":"","ModifiedDate":"1-01-01T00:00:00","CreatedDate":"2009-08-07T19:04:24","NumberOfThreads":1,"NumberOfPosts":1,"CatName":"Animals"}]"




KnowledgeBase.Forum.ForumListStore = new Ext.data.GroupingStore
(
{
proxy: new Ext.data.DirectProxy
(
{
paramsAsHash: false,
directFn: DirectRequest.GetForumView
}
),
autoLoad: true,
groupField:'CatName',
sortInfo: { field: 'CatName', direction: 'ASC' },
remoteSort:false,
groupOnSort: true,
remoteGroup: false,
listeners:
{
load: function(s, records)
{
Ext.MessageBox.alert("Information", "Loaded " + records.length + " records");
}
},
reader: new Ext.data.JsonReader
(
{
idProperty: 'ForumID',
root: '',
totalProperty:'length',
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: 'CatID', type: 'int'},
{name: 'CatName', type: 'string'},
{name: 'ModifiedBy', type: 'string'},
{name: 'ModifiedDate', type: 'date'},
{name: 'LastPostBy', type: 'string'},
{name: 'LastPostThreadId', type: 'int'},
{name: 'LastPostTopic', type: 'string'},
{name: 'LastPostDate', type: 'date'}
]
}
)
}
);

geewhizbang
8 Aug 2009, 8:55 AM
I found the problem on the serverside. The ForumId's were all identical. So once that was fixed I got 3 rows.

I hope this post gets found by people with similar problems, even though the issue was my bad.

The use of the event in the store that I found in another post somewhere was very helpful in discovering what was wrong.