Up and Down Arrow Selecting Non Visible Items

3 posts, 1 answers
  1. Jon Shipman
    Jon Shipman avatar
    43 posts
    Member since:
    Nov 2009

    Posted 27 Oct 2010 Link to this post

    I'm working on a project where I set the visible property on certain listboxitems to false using set_visible(false).  It works great, but if the user uses the up and down arrow to select a listboxitem, the control selects the "hidden" listboxitem which makes it appear that the up/down arrow selection is malfunctioning.

    Is there a way to override this?

    I propose that the up/down arrow functionality be changed to only select the next visible listboxitem.

  2. Answer
    Genady Sergeev
    Genady Sergeev avatar
    1600 posts

    Posted 02 Nov 2010 Link to this post

    Hello Jon Shipman,

    Thank you for reporting this issue to us. I've logged it into our bug tracking system and we will fix it as soon as possible. Meanwhile you can use the following workaround:

    <script type="text/javascript">
         var originalKeyDown = Telerik.Web.UI.RadListBox.prototype._onKeyDown;
         // true -> downwards; false -> upwards
         var modifier = 0;
         Telerik.Web.UI.RadListBox.prototype._onKeyDown = function (e) {
             if (e.keyCode == Sys.UI.Key.down)
                 modifier = 1;
             else if(e.keyCode = Sys.UI.Key.up)
                 modifier = -1;
                 modifier = 0;
             originalKeyDown.apply(this, [e]);
         function changed(sender, args) {
             if (modifier != 0) {
                 var itemsCount = sender.get_items().get_count();
                 var currentIndex = args.get_item().get_index();
                 var item = args.get_item();
                 if (!item.get_visible()) {
                     var itemToSelect = sender.getItem(currentIndex + modifier);
                     if (itemToSelect) {

    I've also updated your telerik points for the report.

    All the best,
    Genady Sergeev
    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
  3. Jon Shipman
    Jon Shipman avatar
    43 posts
    Member since:
    Nov 2009

    Posted 03 Nov 2010 Link to this post

    Great!  Thank you very much!

    I also just recently noticed that if SelectionMode="Multiple", shift + select will select all the hidden listboxitems as well.

    I'm going to be using SelectionMode="Single" for my current project, so I don't need a work-around for this.

    Thanks again.  Telerik has amazing customer support!
Back to Top