This is a migrated thread and some comments may be shown as answers.

kendo grid add group column in jquery

1 Answer 889 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shaktii
Top achievements
Rank 1
Shaktii asked on 09 Sep 2014, 03:55 PM
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.

1 Answer, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 09 Sep 2014, 04:03 PM
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.

 
Tags
Grid
Asked by
Shaktii
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Share this question
or