PDA

View Full Version : Dynamic compositefields



rbastic
31 Aug 2010, 11:56 AM
Hello all,
I am having what I believe to be a simple problem with ExtJS compositefields and yet the solution is evading me. :)

If I have a compositefield with 3 simple fields inside of it, and I'd like to replace the 3rd field dynamically (when a combobox value changes) and have the window re-layout using .doLayout() or some other construct.... How can I do it? I tried manually modifying the .items arrays with the necessary dynamic field (inside a combobox select event) and then calling .doLayout() on the window itself, but it doesn't work.

Is there a better approach, or simply one that does what I need?

Thanks in advance. I can possibly post additional code samples if this is not enough.



// Some sample code (incomplete)
globals['broadcast_win'] = Radius.makeWindow({
title: 'Broadcast Change',
width: 620,
height: 350,
items: [
{
xtype: 'compositefield',
items: [
RT.makeLabel('Changes'),
RT.makeTextArea({
id: 'filters',
name: 'filters',
autoScroll: true,
readOnly: true,
width:275,
height:100
})
]
},
{
xtype: 'compositefield',
id: 'source_composite',
name: 'source_composite',
items: [
RT.makeLabel('Source:'),
fieldCombo1
, opCombo
, RT.makeLabel('Value:')
, srcValue
// (value), changes dynamically!
]
},
{
xtype: 'compositefield',
id: 'target_composite',
name: 'target_composite',
items: [
RT.makeLabel('Target:')
, fieldCombo2
, RT.makeLabel('Value:')
, destValue
// (value), changes dynamically!
]
},
RT.makeHtml('* All values are case-sensitive.<br>'),
RT.makeHtml('** All broadcast change rules are combined using "AND" conditions.<br>')
],
buttons: [
new Ext.Button({text: 'Add', handler: bcAddHandler }),
new Ext.Button({text: 'Remove', handler: bcRemoveHandler }),
new Ext.Button({text: 'Broadcast', handler: broadcastHandler }),
new Ext.Button({text: 'Cancel', handler: broadcastCancelHandler })
]
});
}

globals['broadcast_win'].show();

rbastic
1 Sep 2010, 5:10 AM
It really just comes down to replacing individual elements on a page dynamically. Doesn't necessarily have anything to do with 'compositefield' ....

Anyone have any thoughts?