kendo grid add group column in jquery

2 posts, 0 answers
  1. Shaktii
    Shaktii avatar
    2 posts
    Member since:
    Sep 2014

    Posted 09 Sep 2014 Link to this post

    Hi,

    I want to know is there any way to set group column by clicking on any other check box on same page outside the grid.

    <div id="grid"></div>
    <input type="checkbox" id="chkOrderGroup" />

    //script

    $("#grid").kendoGrid({
      columns: [
        { field: "name" },
        { field: "age",
          groupFooterTemplate: "Total: #= count #"
        }
      ],
      dataSource: {
        data: [
          { name: "Jane Doe", age: 30 },
          { name: "John Doe", age: 30 }
        ]
      }
    });
      $(document).ready(function () {
          $('#chkOrderGroup:checkbox').change(function () {
                var g = $("#grid").data("kendoGrid")
                var objGroup = g.dataSource.group;
             // *******************************  Require code to set  column with name  "age"  as group column when check box is checked *****
          });

    Require code to set  column with name  "age"  as group column when check box is checked.
  2. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2310 posts

    Posted 09 Sep 2014 Link to this post

    Hi Shaktii,


    You are on the right way to achieve this. The group method of the Grid's dataSource should be invoked in order to set the grouping.
    E.g.
    var g = $("#grid").data("kendoGrid");
    g.dataSource.group({ field: "age" });

    I wish you a great day!

    Regards,
    Dimiter Madjarov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top