linuxwindowsinboxwhatsappicloudtweetdeckhipchattelegramhangoutsslackgmailskypefacebook-workplaceoutlookemailmicrosoft-teamsdiscordmessengercustom-servicesmacos
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.1 KiB
42 lines
1.1 KiB
9 years ago
|
/**
|
||
|
* @private
|
||
|
* Custom reader for property grid data
|
||
|
*/
|
||
|
Ext.define('Ext.grid.property.Reader', {
|
||
|
extend: 'Ext.data.reader.Reader',
|
||
|
|
||
|
successProperty: null,
|
||
|
totalProperty: null,
|
||
|
messageProperty: null,
|
||
|
|
||
|
read: function(dataObject) {
|
||
|
return this.readRecords(dataObject);
|
||
|
},
|
||
|
|
||
|
readRecords: function(dataObject) {
|
||
|
var Model = this.getModel(),
|
||
|
result = {
|
||
|
records: [],
|
||
|
success: true
|
||
|
}, val, propName;
|
||
|
|
||
|
for (propName in dataObject) {
|
||
|
if (dataObject.hasOwnProperty(propName)) {
|
||
|
val = dataObject[propName];
|
||
|
if (this.isEditableValue(val)) {
|
||
|
result.records.push(new Model({
|
||
|
name: propName,
|
||
|
value: val
|
||
|
}));
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
result.total = result.count = result.records.length;
|
||
|
return new Ext.data.ResultSet(result);
|
||
|
},
|
||
|
|
||
|
// @private
|
||
|
isEditableValue: function(val){
|
||
|
return Ext.isPrimitive(val) || Ext.isDate(val) || val === null;
|
||
|
}
|
||
|
});
|