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

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

9 Answers 359 Views
Installer and VS Extensions
This is a migrated thread and some comments may be shown as answers.
Rubens
Top achievements
Rank 1
Rubens asked on 19 Nov 2011, 10:57 PM
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?

9 Answers, 1 is accepted

Sort by
0
Kalina
Telerik team
answered on 21 Nov 2011, 11:47 AM
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
0
Jan
Top achievements
Rank 1
answered on 23 Oct 2015, 07:18 AM

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" />

0
Jeff
Top achievements
Rank 1
answered on 25 Mar 2016, 12:16 PM
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! 
0
Ivan Danchev
Telerik team
answered on 30 Mar 2016, 10:24 AM
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.
0
Juan Carlos
Top achievements
Rank 1
answered on 03 Jun 2016, 12:04 PM

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.

0
Jeff
Top achievements
Rank 1
answered on 03 Jun 2016, 01:12 PM

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

 

0
Ivan Danchev
Telerik team
answered on 03 Jun 2016, 03:32 PM
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.
0
Juan Carlos
Top achievements
Rank 1
answered on 03 Jun 2016, 05:58 PM

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.

0
Ivan Danchev
Telerik team
answered on 07 Jun 2016, 01:44 PM
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.
Tags
Installer and VS Extensions
Asked by
Rubens
Top achievements
Rank 1
Answers by
Kalina
Telerik team
Jan
Top achievements
Rank 1
Jeff
Top achievements
Rank 1
Ivan Danchev
Telerik team
Juan Carlos
Top achievements
Rank 1
Share this question
or