This is a migrated thread and some comments may be shown as answers.

Select first row javascript affects wrong grid

2 Answers 475 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Greg
Top achievements
Rank 1
Greg asked on 07 Jan 2016, 08:34 PM

I have a View with a Kendo TabStrip containing multiple grids on multiple panels. On one grid, I need to select the first row after loading data. I'm trying to do this with:

function publicUsersGridDataBound() {
  // Select the first row.
  var grid = $('#publicUsersGrid').data('kendoGrid');
 
  grid.select("tr:eq(1)");
};

 

This works when publicUsersGrid is the only grid on the View.

When I add more grids,

grid.select("tr:eq(1)");

results in the first row in the first grid getting selected, not the first row in publicUsersGridDataBound, even though when I debug the javascript function, the line

var grid = $('#publicUsersGrid').data('kendoGrid');

gets a reference to the correct grid.

I'm stumped.

TIA

2 Answers, 1 is accepted

Sort by
0
Dimiter Topalov
Telerik team
answered on 08 Jan 2016, 04:19 PM
Hello Greg,

This problem is already solved and the fix will be available with the Q1 2016 release, scheduled for next week. Meanwhile, you can use the following workaround:

var grid2 = $("#grid-2").data("kendoGrid");
 
grid2.select(grid2.tbody.find("tr:eq(1)"));

Be aware that when using tbody, the data table rows indexes are zero-based, i.e. the above code will select the second data row, not the first one.

I hope this helps.

Regards,
Dimiter Topalov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Greg
Top achievements
Rank 1
answered on 08 Jan 2016, 05:31 PM
Thanks. Your alternate code works.
Tags
Grid
Asked by
Greg
Top achievements
Rank 1
Answers by
Dimiter Topalov
Telerik team
Greg
Top achievements
Rank 1
Share this question
or