PDA

View Full Version : Calls are doubled



cutigersfan
22 Apr 2010, 9:46 AM
I worked for a while to get a direct setup working. Seems to be working pretty well. I use the following code to load a ListView:


var store = new Ext.data.DirectStore({
storeId : 'sc_accountPastDueStore',
autoLoad : true,
directFn : SC.Entity.getAccountPastDue,
reader: new Ext.data.JsonReader({
id: 'id'
}, [
{name: 'date'},
{name: 'serviceDesc', mapping: 'title'},
{name: 'id', mapping: 'num'},
{name: 'balance'},
{name: 'pastdue', mapping: 'late'}
]),
listeners : {
'exception' : function(sender, type, action, options, response, arg ){
console.warn(response);
},
scope : this
}
});
store.load({ params: { id: view.entityId } });

// create the Grid
var grid1 = new Ext.list.ListView({
store: store,
autoScroll: false,
columns: [
{header: 'Number', dataIndex: 'num'},
{header: 'Date', width: .10, dataIndex: 'date'},
{header: 'Description', width: .10, dataIndex: 'title'},
{header: 'Balance', width: .10, dataIndex: 'balance'},
{header: 'Past Due', width: .25, dataIndex: 'late'}
],
// stripeRows: true,
width: 600,
border:false,
ctCls:'x-accountgrid',
emptyText: 'None found.',
columnResize:false,
title: 'Array Grid'
});


Firebug shows me the request as follows:


[{"action":"Entity","method":"getAccountPastDue","data":[{"id":"3"}],"type":"rpc","tid":6},{"action":"Entity","method":"getAccountPastDue","data":[{}],"type":"rpc","tid":7}]

Obviously there is one with the data and one without. Any ideas why there is two and how to get rid of the one without the parameter?

evant
22 Apr 2010, 3:49 PM
You have autoLoad: true, then you call .load()

cutigersfan
22 Apr 2010, 5:46 PM
Thanks!