Reputation: 475
I have created a panel with accordion layout. I am unable to add dynamic items within the panel. The value of items
is static as shown below. Please help me resolving this issue.
Below is the code:
var panel = new Ext.panel{
scroll: "vertical"
layout{
type: "accordian"
}
items: [{xtype:"panel", title:"123", html:"123"}]
}
How to include dynamic values to items based on JSON?
Upvotes: 3
Views: 2815
Reputation: 16847
You can add items to any given container dynamically with:
var panel = Ext.create('Ext.panel.Panel', {
title: 'Hello World',
layout{ type: 'accordion' },
renderTo: Ext.getBody()
});
var items = [{title:"123", html:"123"},{title:"456", html:"456"}];
panel.add(items);
Edit:
Look in the Touch1.1 docs for more examples.
Ext Touch 1.1 example:
var cnt = new Ext.Container({});
var items = [{title:"123", html:"123"},{title:"456", html:"456"}];
cnt.render(document.body);
cnt.add(items);
cnt.doLayout();
Upvotes: 4