Select All Rows

4 posts, 0 answers
  1. Marc
    Marc avatar
    66 posts
    Member since:
    Jul 2010

    Posted 01 Oct 2012 Link to this post

    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.
  2. OnaBai
    OnaBai avatar
    55 posts
    Member since:
    Aug 2012

    Posted 01 Oct 2012 Link to this post

    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".
  3. Kendo UI is VS 2017 Ready
  4. Nohinn
    Nohinn avatar
    167 posts
    Member since:
    Feb 2011

    Posted 02 Oct 2012 Link to this post

    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');
  5. Andrew
    Andrew avatar
    7 posts
    Member since:
    Oct 2014

    Posted 30 Oct 2014 Link to this post

    grid.select(grid.tbody.find(">tr"));


    Works like a charm!   Thank you!
Back to Top
Kendo UI is VS 2017 Ready