PDA

View Full Version : Unable to access data in Callback (records)



mk00823p
4 Jun 2015, 8:25 AM
In my controller (code below)there is a load function that calls a web service and executes a stored procedure. I can see the data is being returned while using the debug (data in response body.) for the browser. The success = true displays 'In Success' from the alert. However the 'Records: ' records alert returns undefined. FYI - using ExtJS 4.2.1.883 version.

What am I missing or what is needed to work with the data?

Sample of what I see in response body:
{"d":[{"Equip.WebServ.Models.EquipModelExt","LastReadDate":"\/Date(1432844760000)\/","EquipID":"Tank42","IsDirty":false}, {"Equip.WebServ.Models.EquipModelExt","LastReadDate":"\/Date(1432213200000)\/","EquipID":"TankKP","IsDirty":false}]}


Code Snippet:
load: function (OrderRecord, editLoc) {
var me = this;
me._editLoc = editLoc || false;
me._OrderRecord = OrderRecord;
var orderStatusStore = Ext.StoreManager.get('my.store.invOrderStatus');
var modeStore = Ext.StoreManager.get('my.store.tran.Mode');
orderStatusStore.proxy.api.read = serverVars.VMIObjectsWS + 'OrderStatus.asmx/SelectAll';


if (OrderRecord.phantom) {
var modeRec = modeStore.findRecord('Mode', 'rail', 0, true, false, true);
OrderRecord.set('IxMode', modeRec.get('IxMode'));
}


var eqStore = Ext.StoreManager.get('my.store.equip.Equip');
eqStore.proxy.api.read = serverVars.EquipWebService + 'Equip.asmx/SelectByIxLocationAndIxProduct';
eqStore.proxy.extraParams.IxLocation = this._OrderRecord.get('IxLocation_Destination');
eqStore.proxy.extraParams.IxProduct = this._OrderRecord.get('IxProduct');
eqStore.proxy.extraParams.ActiveOnly = true;
eqStore.load({
callback: function (records, operation, success) {
if (success == true) {
alert('In Success');
alert('Records: ' + records);
}
else {
alert('failure loading Equip Store');
}
}
});


orderStatusStore.load({
callback: function () {
if (OrderRecord.phantom) {
var statusRec = orderStatusStore.findRecord('Code', 'New', 0, false, false, true);
OrderRecord.set('IxOrderStatus', statusRec.get('IxOrderStatus'));
}
me.show();
}
});
},


show: function () {
// Other Code
Ext.util.CloseLoadingDialog();
},

joel.watson
5 Jun 2015, 3:44 AM
Hi--

What does your proxy's reader configuration look like?

Thanks
Joel