This is a migrated thread and some comments may be shown as answers.

Custom ComboBox Editor When CheckBoxes == true

3 Answers 102 Views
Filter
This is a migrated thread and some comments may be shown as answers.
Bryan Wilhite
Top achievements
Rank 1
Bryan Wilhite asked on 16 Sep 2011, 08:15 PM
I have reviewed Creating Custom Field Editors and successfully built a RadFilter custom editor with a RadComboBox that returns a single value.

Now I would like to take advantage of the RadComboBox.CheckBoxes property in a new RadFilter custom editor. I call this RadFilterDropDownCheckBoxEditor. I can see during debug that SetEditorValues is only returning the first selected value in the RadComboBox.CheckedItems collection:

public override void SetEditorValues(ArrayList values)
{
    if (values != null && values.Count > 0)
    {
        foreach (var item in values)
        {
            if (item == nullreturn;
            var comboItem = _combo.FindItemByValue(item.ToString());
            if (comboItem != nullcomboItem.Checked = true;
        }
    }
}

This implies that the RadFilter is retaining only one value for this custom editor. I would like the RadFilter to support multiple values for a custom editor.

On the client side, the RadFilter generates *_RadFilterDropDownCheckBoxEditorCombo_Input and a corresponding, hidden field *_RadFilterDropDownCheckBoxEditorCombo_ClientState. The _ClientState value holds a "serialized" JSON object with a checkedIndices array. I can literally see this array correctly tracking the multiple values selected in the custom editor's RadComboBox. However, I assert that this state is not correctly persisted by the RadFilter.SaveSettings method.

Can the good people at Telerik show me some sample code for a custom RadFilter editor using  with RadComboBox.CheckBoxes == true?

3 Answers, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 21 Sep 2011, 09:52 AM
Hi Bryan,

 If you have also overridden the ExtractValues method of the field editor the values will be passed correctly. However by design the different filter expressions (e.g. RadFilterEqualToExpression) internally process and work with only one value (the first one). The current version of RadFilter supports filtering only by single values. As a workaround you can add different filter expressions in RadFilter separated with AND/OR operators.

Kind regards,
Marin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Clint
Top achievements
Rank 1
answered on 16 Jun 2016, 08:04 PM
Did this limitation of the RadFilter ever get fixed?
0
Marin
Telerik team
answered on 17 Jun 2016, 08:36 AM
Hello,

The basic filter expressions of RadFilter are designed to work only with a single value. And filtering by multiple values can be achieved by adding multiple filter expressions combined with an AND or OR operators. 
We cannot change this behavior because it will require redesign of the whole control and the way it processes values from the filter editors.

Regards,
Marin
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Filter
Asked by
Bryan Wilhite
Top achievements
Rank 1
Answers by
Marin
Telerik team
Clint
Top achievements
Rank 1
Share this question
or