PDA

View Full Version : Disabling an Option in a Combobox



gopalr1
6 Jan 2017, 11:05 AM
Hi,

I am not very sure what is the best approach to show an Option as disabled in a Combobox
Will setting a dynamic displayTpl work?
if so, appreciate your help for an illustration with an example

I am trying to display an option in 'disabled' style based on a condition at runtime

so far,: I got
myStore = task_type_combo_box.getStore(); myStore.each(function (r) {
// Disable the Data Item
if(r.data.v_out_event_type == eOption) {
r.data.v_out_event_desc = "Disabled - " + r.data.v_out_event_desc;
}
});
task_type_combo_box.bindStore(myStore);

I am able to show it with a prefix 'Disabled'

I would like to apply a disabled style instead of a prefix

Appreciate your help

Thanks
Raj

Gary Schlosberg
6 Jan 2017, 3:31 PM
Here's a few threads that might help:
https://www.sencha.com/forum/showthread.php?261806
https://www.sencha.com/forum/showthread.php?309181

gopalr1
12 Jan 2017, 7:54 AM
Hi Gary,
Thanks for your reply

I tried



myStore = task_type_combo_box.getStore();
myStore.each(function (r) {
// Disable the Data Item
if(r.data.v_out_event_type == eOption) {
theValue = r.data.v_out_event_desc;
task_type_combo_box.displayTpl = Ext.create('Ext.XTemplate',
'<tpl>', '<div class="x-boundlist-item" style="color:grey | important ;"> {theValue} </div>', '</tpl>'
);
}
});
task_type_combo_box.bindStore(myStore);

and it shows

<div class="x-boundlist-item" style="color:grey | important ;"> </div>




Thanks
Raj