PDA

View Full Version : Adding portlets in a portal dynamically.



pirusira
8 Jun 2010, 5:40 PM
Hello All.

I coded this portal,


var deviceGroup = new Ext.Panel({
title: 'Device Group',
region: 'center'
autoScroll : true,
items: [{
border: false,
xtype: 'portal',
items:[{
columnWidth:.49,
items:[{
title: 'group1',
height: 100
},{
title: 'group2',
height: 100
}]
},{
columnWidth:.49,
items:[{
title: 'group3',
height: 100
},{
title: 'group4',
height: 100
}]
}]
}]
});

and this store.


var store = new Ext.data.JsonStore({
url: 'mainDataCollector.action',
root: 'printerInfo',
idProperty: 'id',
totalProperty: 'total',
fields: [
'id',
'groupName'
]
});

The portal has static portlets now.

What I want to do is this:
If the number of total is 3 then the portal makes 3 portlets and sets the titles of the portlets to be the same as the groupname of the store.

Example:
The store has 3 groups
1. id:1, groupName: 'group1'
2. id:2, groupName: 'group2'
3. id:3, groupName: 'group3'

The portal makes 3 portlets
xtype: 'portal',
items:[{
columnWidth:.49,
items:[{
title: 'group1',
height: 100
},{
title: 'group2',
height: 100
},{
title: 'group3',
height: 100
}]
}]

Is it possible?

Thanks in advance.
Stan

pirusira
9 Jun 2010, 3:48 PM
Is it impossible?