This project is read-only.

Column for multiselection

Oct 25, 2012 at 12:52 PM
Edited Oct 25, 2012 at 12:52 PM

Is it possible to add a column not connected with model but with raw html

where i add a input type='checkbox'  for multiselection ?

PS: also in header ?


Thank You

Oct 25, 2012 at 2:36 PM

Creating not connected  column is possible. Read thi thread -

Creating custom header renderer is not support now. In which scenario you need this functionallity? But you can create a custom cshtml template (like _Grid.cshtml).

Oct 25, 2012 at 2:49 PM
Edited Oct 25, 2012 at 2:49 PM

I would like multiselection,

on row I used :

        .RenderValueAs(d => Html.Raw("<input type='checkbox' name='chksel' class='foo' value='" + d.Id.ToString() + "' id='chksel" + d.Id.ToString() + "' onclick='CheckSelected()' /><label for='chksel" + d.Id.ToString() + "'></label>"));


I would also add a checkbox on header for "Select All"


Any suggestion ?

Oct 25, 2012 at 3:09 PM
Edited Oct 25, 2012 at 3:10 PM

For this purpose you can add a checkbox on the client side via javascript, something like this (using jQuery):


var checkallBox = $(document.createElement("input")).attr({ id: 'checkallitems', name: "CheckedAll", value: "true", type: 'checkbox', checked: false });   

$(".grid-table thead th").eq(0).append(checkallBox); () {        $(".chksel").attr("checked", $(this).is(":checked"));    });

Oct 25, 2012 at 3:14 PM

I know how select all, but I don't know how put a checkbox on header.

Oct 25, 2012 at 3:16 PM

$(".grid-table thead th").eq(0).append(checkallBox);    - this line adds a checkbox to the first column in the grid

Oct 25, 2012 at 3:46 PM

ops.. sorry

yes run !!

Thank You.


PS: very nice project !!