Default Checkbox Selection as "Checked"

2 posts, 1 answers
  1. Steven
    Steven avatar
    1 posts
    Member since:
    May 2017

    Posted 05 Jan 2018 Link to this post

    With the addition of the selectable column, is there a way to default the column so that everything is selected when the grid loads?

  2. Answer
    Eduardo Serra
    Eduardo Serra avatar
    119 posts

    Posted 05 Jan 2018 Link to this post

    Hello Steven,

    There's currently no option in the Kendo UI Grid API that allows for setting the checkbox default state to selected.

    If you just want to set their checked property to true, you could do this on the dataBound event:

    $("#grid tbody input:checkbox").prop("checked", true);

    If instead you want to select them and the rows they belong to, you can trigger their click in the dataBound event:

    $("#grid tbody input:checkbox").trigger( "click" );

    I have prepared a sample in the Kendo UI Dojo where you can try both of the options suggested above: take a look at it here.

    Additionally, the checkbox at the column header can be configured to select all rows through all pages when clicked; this article in our documentation explains how it can be done.

    If you think an option should be added to the API that allows for the default state of the checkboxes to be set to true, I encourage you to participate in the Kendo UI Feedback and Feature Request Portal to voice your opinion; if it gets enough votes, the feature you propose could be implemented by our developers in future releases.

    I hope this helps!

    Eduardo Serra
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top