Question

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

Was it helpful?

Solution

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());}      
    }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top