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(); |
} |
} |
} |