Jul 29, 2013, 12:03 PM
[CLOSED] Disable items of combobox and reenable them based on condition
I need to disable item with "Revenue" text on load of my view and based on some conditon re-enable it.
Here's what i have implemented:
Here's what i have implemented:
X.ComboBox().ID("CmbMetric").Items(
X.ListItem().Text("Price").Value("1"),
X.ListItem().Text("Revenue").Value("2")
).SelectedItems(X.ListItem().Value("1")).FieldLabel("Metric").LabelWidth(70)
.ListConfig(
X.BoundList().Tpl(
X.XTemplate().Html(" <div {[getAttributes(values.disabled)]}>{text}</div> ")
)
)
.Listeners(l => l.BeforeSelect.Handler = "return !record.data.disabled;")
)
and the script contains: var getAttributes = function (disabled) {
var cls = "class='x-combo-list-item";
if (!disabled) {
return cls + "'";
} else {
return cls + " disabled-item'";
}
}
But it is not working.What is that i am doing wrong
Last edited by Daniil; Sep 10, 2013 at 5:31 AM.
Reason: [CLOSED]