Possible bug with CheckBoxes="true" and Filter="Contains"

10 posts, 0 answers
  1. Rubens
    Rubens avatar
    28 posts
    Member since:
    Mar 2008

    Posted 19 Nov 2011 Link to this post

    I have a scenario with a large combo box and want to use RadComboBox filter capabilities to help user to narrow his selection. Consider this example:

    <telerik:RadComboBox runat="server" ID="t" CheckBoxes="true" Filter="Contains">
            <Items>
                <telerik:RadComboBoxItem Text="Sample A"/>
                <telerik:RadComboBoxItem Text="Sample B"/>
                <telerik:RadComboBoxItem Text="Sample C"/>
            </Items>
    </telerik:RadComboBox>

    I type "B" on combobox and "Sample B" is filtered and I check it; I clear all text and now I type "C", also checking it.
    Selecting another control, I expected to see "Sample B, Sample C" as text, but I see one of this:
    • An empty combo
    • Just "Sample B
    • First item text (which btw is unchecked)

    Am I missing something?
  2. Kalina
    Admin
    Kalina avatar
    918 posts

    Posted 21 Nov 2011 Link to this post

    Hello Rubens,

    I am afraid that simultaneous usage of RadComboBox CheckBoxes and Filter features is not a supported scenario.
    Please find more details about this topic at the “Simple CheckBox Support” help article.
    You can try implementing the checkboxes in the RadComboBox ItemTemplate as is demonstrated here.

    Best wishes,
    Kalina
    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. Jan
    Jan avatar
    18 posts
    Member since:
    Mar 2014

    Posted 23 Oct 2015 in reply to Kalina Link to this post

    I know it's an old post, but actually I find this bit of my own code very useful to achieve Rubens' scenario:

    <telerik:RadScriptBlock ID="rsb" runat="server">
        <script type="text/javascript">
        function OnClientDropDownClosed(sender, args) {
                var string = "";
                var combo = $find("<%= rcb_teile.ClientID %>");
     
                //Alle Items in einen String concatenieren
                for (var i = 0; i < combo.get_checkedItems().length; i++) {
                    string = string + combo.get_checkedItems()[i].get_text() + "; ";
                     
                }
                if (string.length > 27)
                {
                    string = string.substring(0, 22) + "(...)";
                }
                //Combobox Text setzen
                combo.set_text(string);
            }
         
        </script>
    </telerik:RadScriptBlock>
     
    <telerik:RadComboBox ID="rcb_teile" runat="server" Width="90%"
        AllowCustomText="false" MarkFirstMatch="true" AutoCompleteSeparator=";"
        CheckBoxes="true" EnableCheckAllItemsCheckBox="false" Filter="StartsWith"
        OnClientDropDownClosed="OnClientDropDownClosed" />

  5. Jeff
    Jeff avatar
    2 posts
    Member since:
    Jun 2013

    Posted 25 Mar in reply to Kalina Link to this post

    IMHO, this is a bug. If two features are added they should work together. Saying it's "not a supported scenario" is basically saying we can't do it. Shame on you Telerik for not fixing your bug! 
  6. Ivan Danchev
    Admin
    Ivan Danchev avatar
    832 posts

    Posted 30 Mar Link to this post

    Hello Jeff,

    As stated in the CheckBox Support article Kalina has linked, filtering is currently not supported when CheckBoxes are enabled. This is not a bug, but a missing feature, because filtering is not implemented for the control when it is set to use CheckBoxes.
    I attached a sample page, which demonstrates a possible workaround that allows the items to be filtered (with CheckBoxes support enabled) by using a TextBox in the ComboBox' HeaderTemplate.

    Regards,
    Ivan Danchev
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  7. Juan Carlos
    Juan Carlos avatar
    3 posts
    Member since:
    Jun 2016

    Posted 03 Jun in reply to Rubens Link to this post

    Hello Rubens, 
    Telerik said that checkboxes + filter is not supported but for me works perfectly if I add this propperty to radcombobox:

    AllowCustomText = "true"

    Regards.

  8. Jeff
    Jeff avatar
    2 posts
    Member since:
    Jun 2013

    Posted 03 Jun Link to this post

    Thank you Juan! That works great and no need to use the javascript workaround. 

     

  9. Ivan Danchev
    Admin
    Ivan Danchev avatar
    832 posts

    Posted 03 Jun Link to this post

    Hello Juan,

    Could you please post your ComboBox markup declaration, so we can check how your configuration affects the ComboBox behavior?

    Regards,
    Ivan Danchev
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  10. Juan Carlos
    Juan Carlos avatar
    3 posts
    Member since:
    Jun 2016

    Posted 03 Jun in reply to Ivan Danchev Link to this post

    Hi again, 

    this is my RadComboBox declaration. With this I can use filter and checkbox together without problems. If you delete the AllowCustomText property when the component lost focus always shows the text of the first item, but with AllowCustomText=true works perfect.

     

    <telerik:RadComboBox runat="server" RenderMode="Lightweight" ID="combo" CheckBoxes="true" AllowCustomText="true" Filter="Contains" EnableCheckAllItemsCheckBox="true" Width="100%">
    </telerik:RadComboBox>

     

    Regards.

  11. Ivan Danchev
    Admin
    Ivan Danchev avatar
    832 posts

    Posted 07 Jun Link to this post

    Hello Juan,

    Thank you for sharing your configuration.

    Although the filtering works with CheckBoxes the reason we have we have mentioned this scenario as not supported in the documentation is that it interferes with the usability of the control. Since with CheckBoxes enabled the checked items are listed one after another in the input area, having filtering enabled requires deleting the currently listed checked items in order to enter new text and filter the items. In addition there are other glitches such as improper dropdown size calculation when filtering the items, then checking one of them, closing the dropdown, opening it again and then deleting the input.

    Regards,
    Ivan Danchev
    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
UI for ASP.NET Ajax is Ready for VS 2017