在EXTJS 3中,我有一个directStore,我想在load事件的第一行获取一个单元格值?请参阅下面的代码,如何在加载事件中获取“SUMMARY_ID”?
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);
}
});
答案 0 :(得分: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();
}
}