Hi everyone,
Client Side, is there a way to set a comboboxItem invisible?
I've tried something like:
... but it's not working.
Can someone point me the correct way?
Thanks in advance!
Client Side, is there a way to set a comboboxItem invisible?
I've tried something like:
var ddlPrecoMax = $find("<%= ddlPrecoMax.ClientID %>"); var maxLength= ddlPrecoMax.get_items().get_count(); for(i=0; i< maxLength; i++) { |
var comboItem= ddlPrecoMax.get_items().getItem(i); |
comboItem.set_visible(false); |
} |
... but it's not working.
Can someone point me the correct way?
Thanks in advance!
6 Answers, 1 is accepted
0
Hello Fernandes,
Actually, the set_visible method of the RadComboBoxItems has not been fully implemented. Therefore, it is not working at the moment. Is it acceptable for you to use the disable() method instead till we fully implement the set_visible() method in the official Q1 release due in April?
Regards,
Nick
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Actually, the set_visible method of the RadComboBoxItems has not been fully implemented. Therefore, it is not working at the moment. Is it acceptable for you to use the disable() method instead till we fully implement the set_visible() method in the official Q1 release due in April?
Regards,
Nick
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Trimox
Top achievements
Rank 1
answered on 13 Mar 2008, 12:42 PM
Might help..
if you just want one item disabled..
var combo = $find("<%= ddlPrecoMax.ClientID %>");
combo.findItemByText("Apples").disable();
or if you want the entire combo disabled
function DisableComboBox() {
var combo = $find("<%=ddlPrecoMax.ClientID %>");
combo.disable();
}
if you just want one item disabled..
var combo = $find("<%= ddlPrecoMax.ClientID %>");
combo.findItemByText("Apples").disable();
or if you want the entire combo disabled
function DisableComboBox() {
var combo = $find("<%=ddlPrecoMax.ClientID %>");
combo.disable();
}
0
Fernandes
Top achievements
Rank 1
answered on 13 Mar 2008, 01:20 PM
Thanks both of you, but what I was looking for was really a way to set them invisible.
I had to go through a different approach.
Thanks anyway!
Fernandes
I had to go through a different approach.
Thanks anyway!
Fernandes
0
Hi Fernandes,
Since you want to loop through all items and set their visibility to false, I would suggest using the clearItems()
method of the ComboBox.
Sincerely yours,
Veskoni
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Since you want to loop through all items and set their visibility to false, I would suggest using the clearItems()
method of the ComboBox.
Sincerely yours,
Veskoni
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Fernandes
Top achievements
Rank 1
answered on 13 Mar 2008, 01:41 PM
HI Veskoni,
I was looping the items collection and I was trying to set invisible some of the items. (depending of its value). I just didn't put that on the first post, for simplicity.
Thanks anyway!
Fernandes
I was looping the items collection and I was trying to set invisible some of the items. (depending of its value). I just didn't put that on the first post, for simplicity.
Thanks anyway!
Fernandes
0
The Wire
Top achievements
Rank 1
answered on 15 Jun 2010, 09:53 PM
I'm having the same issue, but it's 2 years later now so the current version should include the full implementation of set_visible() for the RadComboBoxItem. I'm using 2010.1.519.35.
I've duplicated the Related ComboBox example (http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/multiplecomboboxes/defaultcs.aspx) and added this to my ItemsLoaded function:
My combobox is divided into two sections which is why my loop only goes until it reaches the second section. I want to hide items in the first section that don't start with a user's id, which I hard-coded a 53 in for testing. I want to hide them rather than remove them so the user has the option to later show all items if they would need to select a different user's id. However, the items are not hiding. I've tried the .set_visible(false) and .hide(), neither are working for me. If I uncomment the .set_text() line, all the items get "**" added to their text except those starting with "53", so I know I have reference to each item. I have also tried removing the item too but that doesn't work either:
Couple other things to note: my RadComboBox is inside a GridTemplateColumn in a RadGrid. I'm also using a masterpage within the context of SharePoint so all my controls are in a asp:Content placeholder.
I've duplicated the Related ComboBox example (http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/multiplecomboboxes/defaultcs.aspx) and added this to my ItemsLoaded function:
function ItemsLoaded(combo, eventArqs) |
{ |
if (combo.get_items().get_count() > 0) |
{ |
var sep = combo.findItemByText("Separator"); |
for (var i = 1; i < sep.get_index(); i++) { |
var item = combo.get_items().getItem(i); |
if (item.get_value().substr(0,2) != "53") { |
item.set_visible(false); |
//item.set_text("**" + item.get_text()); |
} |
} |
} |
combo.showDropDown(); |
} |
function ItemsLoaded(combo, eventArqs) |
{ |
if (combo.get_items().get_count() > 0) |
{ |
var sep = combo.findItemByText("Separator"); |
for (var i = 1; i < sep.get_index(); i++) { |
var item = combo.get_items().getItem(i); |
if (item.get_value().substr(0,2) != "53") { |
combo.trackChanges(); |
combo.get_items().remove(item); |
combo.commitChanges(); |
//item.set_visible(false); |
//item.set_text("**" + item.get_text()); |
} |
} |
} |
combo.showDropDown(); |
} |
Couple other things to note: my RadComboBox is inside a GridTemplateColumn in a RadGrid. I'm also using a masterpage within the context of SharePoint so all my controls are in a asp:Content placeholder.