Buy now!

NinjaGrid

Sample 07. Checkbox columns

HTML

                        

JS

                        var columnsModel = new Array();
                        columnsModel.push({ header: "ID", property: "id", width: 60, sort: true });
                        columnsModel.push({ header: "Name", property: "name", width: 200, sort: true });
                        columnsModel.push({header: "Married", property: "married", width: 70, align:"center",
                            isCheckBox: true,
                            disabled: false,
                            onChange: function (obj, td, tr) {
                                var vl = this.is(":checked");
                                alert(obj.name + " is " + (vl? "" : "NOT ") + "married.");
                            }
                        });
                        columnsModel.push({ header: "Birthday", property: "birthday", width: 150, sort: true, align: "center", format: "date" });
                        columnsModel.push({ header: "E-mail", property: "email", width: 250, sort: true });
                        columnsModel.push({ header: "Car Name", property: "car.name", width: 100, sort: true, align: "left" });
                        columnsModel.push({ header: "Car Year", property: "car.year", width: 100, sort: true, align: "right" });

                        //-- call ninjaGrid
                        $("#ninjaGridSample").ninjaGrid({
                            url: "/NinjaGrid/getCustomers",
                            type: "GET",
                            keyColumn: "id",
                            columns: columnsModel,
                            pageSize: 10,
                            sortColumn: "id",
                            sortOrder: "desc",
                            minHeight: 300
                        });