问题
I have external API, proxy is rest, reader defined, type: 'json', rootProperty: 'data;
How to get property "FullName" I have tried with record.get('FullName').
Created function called getDetails, passed as argument string, returned return record.get('FullName), always undefined.
Details: function(v, record) {
return record.get('FullName')
}
Here is onDelete function :
OnDelete: function (record,data) {
Ext.Msg.confirm('Delete Changes', 'Do you want to delete' + " " + record.Details, function (choice) {
if (choice === 'yes') {
var store = Ext.getStore('store.Personnel');
store.remove(record);
store.sync();
}
})
},
this is how console log on record look like. I have 3 constructors with Id's then data, and then obj properties)
回答1:
You should use record.get('FullName') like:
OnDelete: function (grid, rowId) {
var record = grid.getStore().getAt(rowId);
Ext.Msg.confirm('Delete Changes', 'Do you want to delete' + " " + record.get('FullName'), function (choice) {
if (choice === 'yes') {
var store = grid.getStore();
console.log(store)
store.remove(record);
}
})
}
Your example on fiddle: https://fiddle.sencha.com/#view/editor&fiddle/2ttb
来源:https://stackoverflow.com/questions/57083847/how-to-acces-object-property