I am trying to set an object (summary) inside another object's callback method
returnObj.beforeLoadComplete = function (records) {
var someObj = {
total: {
label: 'Items',
value: '15'
},
additional: [{
label: 'Item1 Total',
value: '25000'
}]
};
returnObj.summary = summaryObj;
// some other code which finally returns an object
}
The above code does not work (i.e. summary
is not set on returnObj
)
However if I have the same code outside the callback method, it works as in code snippet below:
var someObj = {
total: {
label: 'Items',
value: '15'
},
additional: [{
label: 'Item1 Total',
value: '25000'
}]
};
returnObj.summary = summaryObj;
returnObj.beforeLoadComplete = function (records) {
// some other code which finally returns an object
}
Not sure why is it so.