RadComboBoxItem javascript .hide() and Filter="Contains"

4 posts, 0 answers
  1. Thomas
    Thomas avatar
    3 posts
    Member since:
    Feb 2010

    Posted 25 Jun 2010 Link to this post

     

     


    I am trying to set conditional RadComboBoxItem visibility using javascript: RadComboBoxItem.hide().  It will work fine without Filter="Contains" enabled on the ComboBox, but when this is turned on, the ComboBox shows the hidden items the second time it is opened.  Is there any way around this.

    Thanks,
    Thomas

    aspx:

     

    <telerik:RadComboBox runat="server" ID="rcbTest" Filter="Contains" > 
        <Items> 
            <telerik:RadComboBoxItem Text="Test1" /> 
            <telerik:RadComboBoxItem Text="Test2" /> 
            <telerik:RadComboBoxItem Text="Test3" /> 
            <telerik:RadComboBoxItem Text="Test4" /> 
        </Items> 
    </telerik:RadComboBox> 
    <asp:CheckBox ID="cbxTest" runat="server" onclick="Test(this);" /> 

    javascript:

     
        function Test(cbx) {  
            var rcb = $find('<%=rcbTest.ClientID %>');  
            var items = rcb.get_items();  
            for (var i = 0; i < items.get_count(); i++) {  
                if (i != 2) {  
                    if(cbx.checked)  
                        items.getItem(i).hide();  
                    else  
                        items.getItem(i).show();  
                }  
                      
            }  
        } 

     

  2. Thomas
    Thomas avatar
    3 posts
    Member since:
    Feb 2010

    Posted 25 Jun 2010 Link to this post

    It looks like you have to expand and then click outside the ComboBox and then expand again.  Clicking the drop down arrow multiple times to show and hide does not cause the same behavior.

    Thomas
  3. Yana
    Admin
    Yana avatar
    5013 posts

    Posted 01 Jul 2010 Link to this post

    Hello Thomas,

    Filter property of the combobox actually provides client-side filtering - it hides some of the items. That's why you cannot use it in your case where you hide items manually.

    Greetings,
    Yana
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  4. Jesus
    Jesus avatar
    1 posts
    Member since:
    Nov 2010

    Posted 29 Apr 2011 Link to this post

    Maybe if you try to disabled those hidden radcomboboxitem.

    IE:
        function DisableItem()
        {      
           var combo = $find("<%= RadComboBox1.ClientID %>");
           var comboItem = combo.get_selectedItem();
           combo.trackChanges();
           comboItem.disable();
           combo.commitChanges();
        }
Back to Top