Affichage des articles dont le libellé est Using hasMany Association not giving me data for my nested xml. Afficher tous les articles
Affichage des articles dont le libellé est Using hasMany Association not giving me data for my nested xml. Afficher tous les articles

vendredi 31 octobre 2014

Using hasMany Association not giving me data for my nested xml

I am getting nested xml from the server


Code:



<row id=1>
<category>
<CategoryId>1</CategoryId>
<CategoryName>test</CategoryName>
</category>
</row>
<row id=2>
<category>
<CategoryId>2</CategoryId>
<CategoryName>test</CategoryName>
</category>
</row>
<row id=3>
<category>
<CategoryId>3</CategoryId>
<CategoryName>tested</CategoryName>
</category>
</row>

for this xml i created model like:


Code:



Ext.define('App.model.CategoryRow',
extend :'App.model.Base',

fields :[{
name :'RowId',
mapping :'@id'
}],
hasMany : ['Category']
});


Code:



Ext.define('App.model.Category',
extend :'App.model.Base',

fields :[{
name :'CategoryId'
},{
name :'CategoryName'
}]
});

Ext.define('App.store.Category',
extend :'Ext.data.Store',
model :'CategoryRow',

proxy :{
type :'ajax',
url :'test/test.php',
reader :{
type :'xml',
record :'row'
}

when i load store with this Model i am getting the RowId but there is no data in record.category() association.

Any idea.


Thnx in advance,






Using hasMany Association not giving me data for my nested xml