Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
15
Checkbox Column on iggrid using view models
posted

I have a view model that is being used to populate a grid using razer. One of the columns is a bool datatype, and I would like the grid to display the current state of each bool in checkbox form. And I would like to be able to edit the checkbox for each row by clicking on the checkbox once.

Is this something that is possible? Currently with the use of infragistics.core.js, the value is displayed correctly with a checkbox but the disabled property is set to true and I have had no luck changing that. 

Parents
No Data
Reply
  • 200
    Offline posted

    Hello Jarrett,

    To render the boolean column via checkbox set renderCheckbox option to true.

    @(Html.Infragistics()
    .Grid(Model)
    .RenderCheckboxes(true)
    …

    In order to directly update the value of the cell you can handle the editCellStarting.

    Afterwards you can update the cell value using setCellValue method.

    Afterwards you can cancel cell updating.

    Here is a sample if the Boolean column's key is 'Fixed'.

    $(document).delegate("#Grid1", "iggridupdatingeditcellstarting", function (evt, ui) {
        if (ui.columnKey !== "Fixed") {
            return true;
        }
        var state = ui.value;
        $("#Grid1").igGridUpdating("setCellValue", ui.rowID, "Fixed", !state);
        return false;
    });

    You can find the sample for more details here.

Children