PDA

View Full Version : rawData undefined for first POST action



lorak
7 Jun 2012, 2:24 PM
Howdy,

I am trying to fill a form with server response data obtained whenever I click on a name in a grid. For the most part, I have succeeded in doing this. However, for some reason, the very first time I click on a name in the grid, I get "undefine" for store.proxy.reader.rawData. It doesn't matter which name I click first, it always does this. Any subsequent clicks return the expected json string. I am using firebug to help me solve the problem.

The following is the code for the store 'PersonS' where I make the ajax request:

Ext.define('CX.store.PersonS',
{
extend: 'Ext.data.Store',
model: 'CX.model.PersonM',
autoLoad: false,
proxy:
{
type: 'ajax',
actionMethods: {
update:'POST'
},
url: '.../CensusXPHP/app/store/getUserIdInfo.php',
reader:
{
type: 'json'
}
}
});

The following is the function within the controller where the above store is loaded.

showMess: function(grid,record)
{
var tempId = record.get('transId'); //grab translation ID
var name = record.get('fname') + ' ' + record.get('lname'); //grab name of current user
var store = this.getPersonSStore();
store.load(
{
params:{cid:tempId}
})

var info = store.data;
console.log(info)
console.log(store.proxy.reader.rawData)
}
};
I am printing two things to the console: the store.data object and store.proxy.reader.rawData. The image immediately below shows the POST and console print statements for the first two click events.
36063
I clicked on the same name both times. As you can see, the store.data object says it has zero items during the first click and the rawData is "undefine; HOWEVER, when I expand the information for store.data object for the first click you can see that there is indeed an item with the json string (it is the same info as the second click item because I clicked on the same name twice). The second image shows this.
36068

I have no idea what's going on. I have been working with ExtJS for about two weeks so it is difficult for me to see any subtle errors (or even glaring ones :s). Will someone please point me in the right direction?

Thanks for your help!
-K