I have the following situation. I have a TreeStore that is synced with my server. The server response returns the modified node data with an additional property 'additionalTasks' (which stores some server-generated info for new nodes). How can I get this property's value if all of the store's listeners get already an instantiated record object and not the raw response data ? I've tried adding this additional field to my model, but when I check it's value for the records in the listener function they're shown as null.
Ext.define('ExtendedTask', {
extend: 'Ext.data.NodeInterface',
fields: [
{ name : 'additionalData', type : 'auto', defaultValue : null, persist : false}
]
});
var store = Ext.create("Ext.data.TreeStore", {
model : 'ExtendedTask',
autoSync: false,
proxy : {
method: 'GET',
type : 'ajax',
api: {
read : 'tasks.js',
update : 'update.php',
create : 'update.php'
},
reader : {
type : 'json'
}
},
listeners: {
update : function(){
console.log('arguments: ', arguments);
}
}
});
And this is my update.php response :
<?php
echo '[ { "Id" : 1,'.
'"Name" : "Planning Updated",'.
'"expanded" : true,'.
'"additionalData": ['.
' {'.
' "Name" : "T100",'.
' "parentId" : null'.
' }'.
']'.
']';
?>
The store's proxy always keeps the raw response from the most recent request. Try something like this and see if the information you need is there.
update : function(){
console.log(this.proxy.reader.rawData);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With