Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding items dynamically to accordion layout

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?

like image 636
Karthikeyan P Avatar asked Feb 13 '26 20:02

Karthikeyan P


1 Answers

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();
like image 195
A1rPun Avatar answered Feb 15 '26 10:02

A1rPun



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!