I am trying to populate all the records at once in a model and then assign each collective property to different container.
i.e. I have 1 grid and 1 combo on my page and trying both in one call. So I fetch the data successfully but it comes in forms of Nested JSON Data.
Ext.Model ('Person', {
fields: [
{ name: 'firstname' },
{ name: 'lastname' },
{ name: 'placesOfWork' }
],
associations: [
{ type: 'hasMany', model: 'PlaceOfWork', name: 'placesOfWork' }
});
this is my model class and whenever I try to assign it to grid so first thing I must need to iterate through each property and then create a new store at runtime to assign the data.
First I read the data by using store.reader.JsonData.placesOfWork which returns me a jsonArray and then create a store using the array elements.
Problem is not this as I got my data in grid and combo. But whenever I try to get my grid and store or comboValue then it always returns me null or store size "0"
var grid = Ext.getCmp("MyGRidID");
var store = grid.getStore();
alert(store.getCount());
It returns me 0 while data is available in my grid. similar thing happen when I try to get value from my combo which was dynamically bonded.
var combo = Ext.getCmp("MyCombo");
var value = combo.getValue();
var rawValue = combo.getRawValue();
alert(value);
alert(rawValue);
Both returns null and empty value.
Aucun commentaire:
Enregistrer un commentaire