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

Select All Rows

3 Answers 2319 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Marc
Top achievements
Rank 1
Marc asked on 01 Oct 2012, 05:40 PM
Anyone have js code snippet to select all grid rows?

I don't have checkboxes or anything. I just want the rows to go into the selected state.

3 Answers, 1 is accepted

Sort by
0
OnaBai
Top achievements
Rank 2
answered on 01 Oct 2012, 10:40 PM
Basically you need to do:
grid.select(grid.tbody.find(">tr"));
Where grid is the result of creating a kendoGrid:
var grid = $("#Expenses").kendoGrid({
    columns:...,
    selectable: "multiple",
    dataSource:...
}).data("kendoGrid");
NOTE: It is actually very important to have selectable set to "multiple".
0
Nohinn
Top achievements
Rank 1
answered on 02 Oct 2012, 08:46 AM
Or if you only want to mimick the css style applied to the selected rows, without enabling selection at all, you can also use this:
var grid = $('#grid').data('kendoGrid');
grid.tbody.children('tr').addClass('k-state-selected');
0
Andrew
Top achievements
Rank 1
answered on 30 Oct 2014, 02:59 PM
[quote]grid.select(grid.tbody.find(">tr"));[/quote]

Works like a charm!   Thank you!
Tags
Grid
Asked by
Marc
Top achievements
Rank 1
Answers by
OnaBai
Top achievements
Rank 2
Nohinn
Top achievements
Rank 1
Andrew
Top achievements
Rank 1
Share this question
or