PDA

View Full Version : Ext.data.DirectStore and gridpanel not working



mdamen
28 Dec 2009, 3:53 AM
I'm trying to create a gridpanel with an ext.data.directstore data store.
Using firebug I do see a request for data.

Here is my ext.data.directstore:


eventstore = new Ext.data.DirectStore({
paramsAsHash: true,
directFn: Remote.DirectAPI.getevents,
fields: [
{name: 'source'},
{name: 'description'},
{name: 'datetime'}
],
root: 'data'
});

eventstore.load();


The Remote.DirectAPI.getevents function returns a JSON array with data, the complete request response is here:

{"tid": 2, "action": "DirectAPI", "type": "rpc", "method": "getevents", "result": {"data": [{"source": "native", "description": "Testing 1234", "datetime": "yes man"}]}}

Here is my grid:


// create the Grid
var EventGrid = new Ext.grid.GridPanel({
store: eventstore,
columns: [
{id:'datetime',header: 'Date/time', width: 100, sortable: true, dataIndex: 'datetime'},
{header: 'Source', width: 100, sortable: true, dataIndex: 'source'},
{header: 'Description', width: 400, sortable: true, dataIndex: 'description'}
],
stripeRows: true,
height: 180,
width: 600,
stateId: 'grid'
});


Any suggestions?/Troubleshooting steps to take?
I had a look at eventstore.data.items, but it's empty... how can I catch exceptions in loading the data?

mdamen
28 Dec 2009, 12:27 PM
This problem was solved. Upgrading to ExtJS 3.1.0 did the trick! (I was still on 3.0.0)