0

In the EXTJS 3, I have a directStore, I want to get a cell value in the first row in the load event ? please see the code below, how to get 'SUMMARY_ID' in the load event ?

 var store = new Ext.data.DirectStore({
            directFn: Report.ReadExceptionSummary,
            autoLoad: false,
            ....
            root: 'Summary',
            idProperty: 'SUMMARY_ID',
            totalProperty: 'total',
            fields: [
                { name: 'SUMMARY_ID', type: 'string' },
                 .....
            ],
            remoteSort: false,
            listeners: {
                load: function (store, recs, opt) {
                    // how to get first row 'Summary ID' value /
                }
            },
            exception: function (ex) {
                Ext.Msg.alert('Error', 'There was an error retrieving the Report.\n' + d.reader.jsonData.errorMessage);
            }
        });
4

1 回答 1

0

这是从第一行获取值的方法:

load: function (store, records) {
    if (records.length > 0) {
        var SUMMARY_ID = records[0].get('SUMMARY_ID');

        //this would also work because you defined SUMMARY_ID as idProperty
        var SUMMARY_ID = records[0].getId(); 
    } 
}
于 2013-01-10T08:51:55.463 回答