Custom Control and RadComboBox

Posted by Community Admin on 04-Aug-2018 12:21

Custom Control and RadComboBox

All Replies

Posted by Community Admin on 28-Nov-2013 00:00

Hi

I've setup a custom control in a class libary.
In the Designer.ascx template I have a RadComboBox.

The ComboBox has 3 values: Red - 0 Green - 1 Blue - 2

When editing a back-end page:
I Edit the control, the correct combobox Value is selected
However the selected text(index) is always sat on the first item....
On Save the correct value is persisted to the Property data.

For Example:
If the property value is 2...
The SelectedValue is set correctly to 2-Blue
The initially selected item displayed is Red

This is part of the JS code for the designer:

    // loads the current control settings
    refreshUI: function ()
        var data = this._propertyEditor.get_control();
        this.get_comboBoxControl().set_value(data.MyComboProperty);
    ,
    // called when user clicks save button
    applyChanges: function ()
        var controlData = this._propertyEditor.get_control();
        controlData.MyComboProperty = this.get_comboBoxControl().get_value();
   

Any help appreciated

Regards

Martin

Posted by Community Admin on 28-Nov-2013 00:00

Figured it out!

Can't use:
this.get_comboBoxControl().set_value(data.MyComboProperty);

Must use:
this.get_comboBoxControl().findItemByValue(data.MyComboProperty).select();

Regards

Martin

This thread is closed