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

Grid event: Sort, Group

9 Answers 758 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Thiam Chye
Top achievements
Rank 1
Thiam Chye asked on 09 Apr 2013, 04:02 AM
Hi there,

I looked through the docs and the forums, but is unable to find any hint about this... for KendoUI Grid, are we able to listen to sort and group events? If so, how could we do this?

Thank you!

9 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 09 Apr 2013, 07:17 AM
Hi Thiam,

 The Kendo UI Grid doesn't support such events. All supported events are listed in the documentation: http://docs.kendoui.com/api/web/grid#events

Regards,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Thiam Chye
Top achievements
Rank 1
answered on 09 Apr 2013, 07:35 AM
Thanks for the fast response. Will future KendoUI updates support these grid events? For now, are there any workarounds for us to detect for grid sort and grid grouping changes?

Thank you!
0
Atanas Korchev
Telerik team
answered on 09 Apr 2013, 07:44 AM
Hi Thiam,

What do you want to achieve by subscribing to such events?

Regards,

Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Thiam Chye
Top achievements
Rank 1
answered on 09 Apr 2013, 08:04 AM
One of the use case which I am looking at is to better integrate the visualizations within our application. E.g. We have a barchart and grid which represents the same dataset. When the user sorts a grid column, the barchart would react and sort based on the same attribute. Similarly, when the user groups by a particular column, the barchart would group its data correspondingly. To enable this, we probably need to listen and react to the grid events.
0
Accepted
Atanas Korchev
Telerik team
answered on 09 Apr 2013, 08:12 AM
Hello Thiam,

 If you are using the same data source instance you shouldn't need to do anything. All widgets bound to a data source react to any changes applied to it.

 If you are using different data sources you can listen to the change event of the grid data source and update the chart.

I hope this helps,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Volker
Top achievements
Rank 1
answered on 28 Mar 2014, 03:35 PM
Sorry for hijacking this thread, but I have a related question:

We need the behaviour that, after grouping, the groups in the grid are collapsed (by default, they are expanded). So I though of listening to a "grouping" event, and when it occurs, to collapse all rows.

Is there any other way to achieve this behaviour? In our case, it is really about being able to use Kendo for that product or not...
0
Atanas Korchev
Telerik team
answered on 28 Mar 2014, 03:49 PM
Hello,

This can also be detected via the change event. You can store the last grouping configuration and compare it with the current one. Here is how this can be done:

var grouping = "";

$("#grid").kendoGrid({
  dataSource: {
      /* other configuration */
      change: function() {
            var currentGrouping = JSON.stringify(this.group());
            if (currentGrouping != grouping) {
                // the current grouping configuration has changed
               grouping = currentGrouping;
               // collapse the groups.
            }
      }
  }
}

Regards,
Atanas Korchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Volker
Top achievements
Rank 1
answered on 01 Apr 2014, 01:14 PM
Hello,

with your answer and this forum entry (http://www.telerik.com/forums/grid-grouping---default-a-group-as-collapsed) I finally managed to get the behaviour I desired. BUT: The paging is not updated automatically in this case.

Let's say I have a grid with 10 entries per page. And I have 10 entries in the first grid group. Now, if I collapse it, I have only 1 entry in the grid, and not the 10 I expected.

Is there a way to handle that? 

Thanks in advance. As the competition supports this scenario, I would be quite glad to find a solution also with Kendo UI.


0
Atanas Korchev
Telerik team
answered on 01 Apr 2014, 01:39 PM
Hi Volker,

This scenario isn't supported. Collapsing a group won't show more items. The Kendo UI DataSource pages the items within the groups and doesn't differentiate between visible and hidden items. There is no workaround that will enable this behavior.

Regards,
Atanas Korchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Thiam Chye
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Thiam Chye
Top achievements
Rank 1
Volker
Top achievements
Rank 1
Share this question
or