Reputation: 55
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
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)");
}
Upvotes: 4