Try our conversational search powered by Generative AI!

Enable/Disable SelectItem in SelectionFactory



Does anyone know if it's possible to add custom attributes per SelectItem from a SelectionFactory? I'm creating a property with a custom EditorDescritor to select multiple values in a CheckBoxListEditor (similar to the SelectMultiple attribute)

I would like to have a SelectionFactory generated from a category node. Some of these categories are not selectable and I would like to mimic this behaviour in the CheckBoxListEditor as well. I don't want to hide them or anything, just disable the checkboxes or make them readonly or something like that.

It seems SelectItem only has two properties for Text and Value, so how would I do this?

Jul 02, 2015 11:18


I think that you need to create a custom widget that inhertis from "epi-cms/contentediting/editors/CheckBoxListEditor"

Jul 02, 2015 12:58


If there is no built in support for this, I guess it's the only way. But I'm guessing this is rather complicated since the source for the list is SelectItem? I would probably have to create a custom class for the items as well...

Jul 02, 2015 13:19

The SelectionFactory works on ISelectItem interface. You could check what happened when you return object of class:

class ExtendedSelection: ISelectItem
    public object Value { get; set; }

    public string Text { get; set; }

    public bool Enabled { get; set; }

Then debug JavaScript widget CheckBoxListEditor and check what is inside this.selections property. Maybe there will enabled property as well.

Jul 02, 2015 13:45

That's a good idea! I'll try that, thanks.

Jul 02, 2015 13:47


I prepared the solution and described implementation in a tutorial way. Here is the link.

The full source code is available on Gists.

Jul 10, 2015 11:16
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.