Select Row By Index Value

1 Answer 3195 Views
Grid
Nicholas
Top achievements
Rank 1
Nicholas asked on 03 Feb 2017, 08:34 PM

Hi --

We have a grid with an action button in the column. When the user clicks the button this code executes.

function showDetails(e) {
     e.preventDefault();
 
     var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
     var grid = $("#gridEnrollments").data("kendoGrid");
     grid.select($(e.currentTarget).closest("tr"));
 
     selectedIndex = grid.select().index();
}

 

The selected row index value is now in the selectedIndex variable.

I would like to then be able to do grid.select(selectedIndex +1).

However, when I do this the selected row is the one above as opposed to below the currently selected row.

How can I achieve what I am looking to do?

Thanks

Rich

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Eduardo Serra
Telerik team
answered on 06 Feb 2017, 06:13 PM
Hello Nicholas,

I have taken your code and prepared a sample that achieves to replicate the behavior you describe; you can take a look at it in the following Kendo UI Dojo.

We can see in the Kendo UI Grid API that the select method row parameter can be a string, a DOM element, or a jQuery object. 

I hope this helps!

Regards,
Eduardo Serra
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Nicholas
Top achievements
Rank 1
Answers by
Eduardo Serra
Telerik team
Share this question
or