This is a migrated thread and some comments may be shown as answers.

Need list box focus after removing an item

1 Answer 133 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Dev
Top achievements
Rank 1
Veteran
Dev asked on 31 Dec 2019, 11:22 AM

After removing an item in the list box it does not focus on the first item by default, We need an option to focus on the first item. Attached screenshot & video link for your reference. Please check 

Video link and screenshot

1 Answer, 1 is accepted

Sort by
0
Hetali
Telerik team
answered on 31 Dec 2019, 03:35 PM

Hi Rick,

Thank you for the screen shot and the screen recording.

In order to focus on the first item when you remove an item from the Kendo UI ListBox, please use the select method in the remove event. Make sure to use the setTimeout() method so that the first item is selected after the remove function is executed. For example:

$("#listBox").kendoListBox({
  remove: function(e) {
    setTimeout(function() {
      var listBox = $("#listBox").data("kendoListBox");
      listBox.select(listBox.items().first());	
    })
  }
});

In this Dojo example, the first item in the ListBox is selected every time an item is removed.

Please let me know if this helps or if you have any further questions pertaining to this case.

Regards,
Hetali
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
ListBox
Asked by
Dev
Top achievements
Rank 1
Veteran
Answers by
Hetali
Telerik team
Share this question
or