Hello,
As do many, I use a RadListBox inside of a RadComboBox's ItemTemplate to implement multiple selections.
One thing I want to provide is a maximum height of the RadListBox, similar to a RadComboBox.
Purpose:
For site-wide consistency, at max the RadListBox can be 170px high. If there are fewer rows than fill up the space, then the height should be automatic.
I'm not setting a height on the RadComboBox and/or RadListBox so that they render in their unaltered size. In the RadComboBox OnClientOpened event, I capture the size of the rcbSlide, which is the only element that I see that holds the actual height of the dropdown when it's expanded. If the value is greater than 170px then we need to limit the height by resizing the RadListBox and the rcbSlide. (I tried OnClientOpening, but the height hasn't been set at that point...)
Here is the JavaScript that I have so far. At this point it's setting the height of the dropdown, but the overflow scrollbars do not appear on the RadListBox as I'd expect...
Thoughts??
Thanks!
Thad
As do many, I use a RadListBox inside of a RadComboBox's ItemTemplate to implement multiple selections.
One thing I want to provide is a maximum height of the RadListBox, similar to a RadComboBox.
Purpose:
For site-wide consistency, at max the RadListBox can be 170px high. If there are fewer rows than fill up the space, then the height should be automatic.
I'm not setting a height on the RadComboBox and/or RadListBox so that they render in their unaltered size. In the RadComboBox OnClientOpened event, I capture the size of the rcbSlide, which is the only element that I see that holds the actual height of the dropdown when it's expanded. If the value is greater than 170px then we need to limit the height by resizing the RadListBox and the rcbSlide. (I tried OnClientOpening, but the height hasn't been set at that point...)
Here is the JavaScript that I have so far. At this point it's setting the height of the dropdown, but the overflow scrollbars do not appear on the RadListBox as I'd expect...
function
multiSelect_RadComboBox_Opened(sender) {
var
height = sender.get_dropDownElement().parentElement.style.height;
if
(height.length > 0) {
height = height.substring(0, height.length - 2);
if
(height > 170) {
sender.get_dropDownElement().parentElement.style.height =
'170px'
;
var
items = sender.get_items();
items.getItem(0).findControl(
'rlbItems'
).get_element().style.height =
'170px'
;
}
}
}
Thoughts??
Thanks!
Thad