PDA

View Full Version : How to change a component's config dynamically?



hexawing
28 Nov 2011, 10:26 AM
For example, when I select one value, a certain combo should be set "multiSelect: false". And when I select another value, the combo will be "multiSelect: true" to allow multiselect.

Can this be done?

skirtle
28 Nov 2011, 11:04 AM
In general you can't change config options dynamically. It depends on the component and the config option as to whether it is possible. Many config options are interpreted only at instantiation time without support for subsequent changes.

For multiSelect on a combobox it would be a little fiddly. Just switching the property value would get you most of the way there but you'd have to muck around with the bound list picker to change its selection model. It'd almost certainly be easier just to create a new combobox.

hexawing
30 Nov 2011, 5:58 PM
Could you show me a very simple example? Thanks a lot!

skirtle
30 Nov 2011, 5:59 PM
Could you show me a very simple example? Thanks a lot!

Of what?

narram123
15 Jan 2012, 9:34 PM
Hi,

I have the same thing to be done in a fieldset. Could you show me an example to change the config properties dynamically?

skirtle
15 Jan 2012, 11:23 PM
@narram123. Please can you start a new thread explaining exactly what you're trying to do? As I explained previously it isn't possible to change config options in the general case so your question will need to be specific.

orangemammoth
27 Jun 2012, 12:10 PM
[component grid object or getCmp].selModel.setSelectionMode('MULTI');

[component grid object or getCmp].selModel.setSelectionMode('SINGLE');