PDA

View Full Version : problem with JsonReader when loading data



shahab_et
10 Jan 2011, 7:27 AM
Hi,
there is a form in which I have a grid that is bound to "ds".
this form has a parameter and "ds" will use that parameter "id" to get desired data from server.
everything goes fine and Jason is received from server,
but only the last row in the RESPONSE is set to "ds" and is displayed in the grid !!!


any suggestions ?!

Thanks for your help,





var id = myRecord!=null ? myRecord.get('id'): '';

var ds = new Ext.net.Store({
url: "/industrialWebClient/seam/resource/myresource?op=2&id="+id,
reader: new Ext.data.JsonReader({
fields: [
{name: 'id'},
{name: 'rowNumber'},
{name: 'desc'},
{name: 'ledgerCodetxt'},
{name: 'ledgerName'},
{name: 'floatingtxt'},
{name: 'floatingName'},
{name: 'projecttxt'},
{name: 'projectName'},
{name: 'costCentertxt'},
{name: 'costCenterName'},
{name: 'articleCurrencytxt'},
{name: 'articleCurrencyName'},
{name: 'currencyAmount'},
{name: 'currencyRate'},
{name: 'debit'},
{name: 'credit'}
],
totalProperty: 'totalCount',
root: 'rows'
}),
storeId: 'myStore'
});

ds.load({callback: function(records,o,s){
alert('Records: ' + records.length);
grid.render();
}});