I have a Kendo list view that displays list of candidates with list view selection mode set to multiple. I would want to disallow selection of only the first item in the list. In other words, apart from the first item in the list view, all other items are selectable. Please suggest with sample jQuery code on how to achieve it.

Thanks and regards, Damodar

有帮助吗?

解决方案

Try the following code :

 $("#listView div:first-child").toggleClass('k-selectable');

Hope this helps!

UPDATE :

In order to select the first item, you need to add the following code :

var listView = $("#listView").data("kendoListView");
listView.select(listView.element.children().first());

UPDATE2:

To keep the item selected irrespctive of what changes, handle the change event of the grid as follows :

change: function() {
      if(!(this.element.children().first().hasClass('k-state-selected')))
        {this.select(this.element.children().first());}      
    }
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top