November Happy Hour will be moved to Thursday December 5th.

Switch editor for property with SelectionFactory

Ted
Ted
Vote:
 

I'm trying to switch to the FilteringSelect widget to make it easier to make a selection in a rather long list.

I have a property like the following:

[SelectOne(SelectionFactoryType = typeof(CountrySelectionFactory))]
[UIHint(FilteringSelectEditorDescriptor.UIHint)]
public virtual string Country { get; set; }


My editor descriptor looks like:

    [EditorDescriptorRegistration(TargetType = typeof(string), UIHint = UIHint)]
    public class FilteringSelectEditorDescriptor : EditorDescriptor
    {
        public const string UIHint = "FilteringSelectEditor";

        public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable attributes)
        {
            base.ModifyMetadata(metadata, attributes);

            metadata.ClientEditingClass = "dijit.form.FilteringSelect";
        }
    }

However, I just end up with the standard Select editor.

I've also tried setting the editor class using the ClientEditor attribute on the property, but to no avail.

I've also tried setting the ClientEditingClass inside the selection factory, but that just breaks the UI. :)

Any bright ideas? :)

#119626
Mar 31, 2015 20:02
Ted
Vote:
 

I tried inheriting SelectOneAttribute to create an attribute which sets the editor to FilteringSelect, but that also breaks the UI:

[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
    public class FilteringSelectOneAttribute : SelectOneAttribute, IMetadataAware
    {
        void IMetadataAware.OnMetadataCreated(ModelMetadata metadata)
        {
            OnMetadataCreated(metadata);

            var extendedMetadata = metadata as ExtendedMetadata;

            if (extendedMetadata == null)
            {
                return;
            }

            extendedMetadata.ClientEditingClass = "dijit/form/FilteringSelect";
        }
    }

Weird thing is, if I set ClientEditingClass to "epi/shell/form/AutoCompleteSelectionEditor" (which inherits FilteringSelect) I actually get a FilteringSelect-like editor (even though it breaks because it has no store set).

Oh well, any suggestions are greatly appreciated. :)

#119627
Edited, Mar 31, 2015 20:13
* 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.