PDA

View Full Version : How to access messageProperty



mjhaston
8 Feb 2013, 1:39 PM
I'm attempting to send back additional data in my JSON to let me know that my grid contains error messages. I have the info coming back in my JSON. I've been looking for 2 hours at posts on how to access so I can do something, but so far no luck.

Everything points to accomplishing this in a callback function ... which I've never done either!

All help appreciated!


STORE:


var storeFromServer = Ext.create('Ext.data.Store', {
model : 'Members',
proxy : {
type : 'ajax',
url : '/cgi-bin/xxxxx.pgm',
reader : {
type : 'json',
root : 'data',
idProperty : 'id',
totalProperty : 'results',
messageProperty : 'hasErrors'
}
},
autoLoad : false
});



JSON:


{
"success": true,
"data": [
{
"id": "1",
"first": "michael",
"e01": "",
"last": "",
"e02": "Last name is required",
"addr1": "",
"e03": "",
"addr2": "",
"e04": "",
"addr3": "",
"e05": "",
"city": "",
"e06": "",
"state": "",
"e07": "",
"zip": "",
"e08": "",
"cntry": "",
"e09": "",
"mbrdob": "",
"e10": "Member DOB is required",
"spodob": "null",
"e11": "",
"retire1": "null",
"e12": "",
"retire2": "null",
"e13": "",
"retire3": "null",
"e14": "",
"entity": "",
"e15": "Entity is required",
"fund": "",
"e16": "Fund is required",
"rppct": "",
"e17": "",
"annual": "",
"e18": "",
"comp": "",
"e19": "",
"invest": "",
"e20": "Investment rate is required",
"value": "",
"e21": "",
"type": "",
"e22": "Type is required"
}
],
"results": 1,
"hasErrors": true
}



STORE.LOAD():


storeFromServer.load({
params : {
task : 'load'
},
callback : function() {

}
});

mjhaston
8 Feb 2013, 2:17 PM
It seems I found the answer ...



callback : function(proxy, operation) {
console.log(operation.resultSet.message)
}




I was looking for it to return in "hasErrors"