don Anand
don Anand

Reputation: 55

Kendo UI grid first row always selectable and highlight

I need first row always selected default and should be highlighted. I am using kendo UI grid. My UI code here. -

 kendo-grid="vehicleTypeGrid" k-sortable="true"
   k-data-source="vm.primaryEntityList" k-pageable='{"pageSizes":true }'
   k-selectable="true"                    
   k-columns='vm.primaryEntityGridColumns'
   k-on-change="vm.onGridRowSelectionChanged(data, dataItem, columns)"
   k-on-data-bound="vm.primaryGridDataBound(kendoEvent).

I tried some of the code in griddatabound event:

 - baseVm.prototype.primaryGridDataBound = function (e) 
  {     
  grid.element.find('tbody tr:first').addClass('k-state-selected');

};

This code worked for highlighted only. But I need first row always selected default and highlighted.

Upvotes: 4

Views: 10516

Answers (1)

ezanker
ezanker

Reputation: 24738

You can use the grid's select() method on databound:

http://docs.telerik.com/KENDO-UI/api/javascript/ui/grid#methods-select

dataBound: function(e) {                          
  e.sender.select("tr:eq(1)");
}

DEMO

Upvotes: 4

Related Questions