mercredi 24 juin 2015

How to add Checked Column in Kendo Grid

@model IEnumerable

@ViewBag.Title

    @(Html.Kendo().Grid(Model)
                  .Name("grid")                      
          .Columns(columns =>
          {
              columns.Bound(model => model.ISSelected).Template(@<text></text>).ClientTemplate("<input type='checkbox' #= ISSelected ? checked='checked':'' # class='chkbx' />");
              //columns.Bound(model => model.ISSelected)///Bound(model => model.ISSelected)
              //.ClientTemplate("<input type='checkbox' #= ISSelected ? checked='checked' : '' # disabled='enabled' ></input>");
                  columns.Bound(model => model.CoursesSystem_ID).Visible (false);
                  columns.Bound(model => model.per_Name);
                  columns.Bound(model => model.per_Family);
                  columns.Bound(model => model.stu_ID).Visible (false);

              })
            .ToolBar(toolbar =>
                        {
                            toolbar.Custom().Action("CreateStudents", "CoursesSystem", new {_StudendsShowCreatAddViewModel = @Model }).Text("ثبت");
                        }
            )
            .Groupable()
            .Pageable()
            .Sortable()
            .Scrollable()
            .Filterable()
            .DataSource(dataSource => dataSource
                                        .Server()
                        )                         
    )

<script>
    $(function() {
        $('#grid').on('click', '.chkbx', function() {
            var checked = $(this).is(':checked');
            var grid = $('#grid').data().kendoGrid;
            var dataItem = grid.dataItem($(this).closest('tr'));
            dataItem.set('ISSelected', checked);
        });
    });
</script>

I tried the above column properties Boolean ==>Isselected

to checked Column and Editable

And not Work

For example, such as Photo




Aucun commentaire:

Enregistrer un commentaire