View Full Version : dynamic data in store and template

27 Nov 2009, 6:47 AM

I have a store and a template within a panel. My store get the data with metaData because my root can change to indicate what type of data is stored.

Could I define a template which iterate over my store and display the data independent of the changing root element? The fields are always the same.

My approach was the following:

tplMarkup: [
'<div class="x-tagCloud">',
' <ul>',
' <tpl for="keywords">', //this could change for different data
' <li ><a class="{weight:this.getFontSize}" id="{#}" href="#">{tag}</a></li>',
' </tpl>',
' </ul>',

{metaData: {"root":"keywords",
"fields": [{"name": "tag"},{"name": "weight"}]
"keywords":[{"tag":"CCCI metrics","weight":1},{"tag":"mashup","weight":4},{"tag":"quality","weight":1},{"tag":"reputation","weight":1},{"tag":"trust","weight":1},{"tag":"data","weight":1},{"tag":"information","weight":1},{"tag":"integration","weight":1},{"tag":"model","weight":1}]};and the store:

this.store = new Ext.data.JsonStore({
storeId: 'tagStore',
root: 'tagList',
fields: [{name:'tag',type:'string'},{name:'weight',type:'int'}]
});//end of storeBut I have no idea for iterating over the store and than overwrite the template. Could you help me?