Custom ComboBox Editor When CheckBoxes == true

4 posts, 0 answers
  1. Bryan Wilhite
    Bryan Wilhite avatar
    1 posts
    Member since:
    Jul 2004

    Posted 16 Sep 2011 Link to this post

    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?
  2. Marin
    Admin
    Marin avatar
    1045 posts

    Posted 21 Sep 2011 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Clint
    Clint avatar
    3 posts
    Member since:
    Oct 2015

    Posted 16 Jun in reply to Marin Link to this post

    Did this limitation of the RadFilter ever get fixed?
  5. Marin
    Admin
    Marin avatar
    1045 posts

    Posted 17 Jun Link to this post

    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.
Back to Top