Grid event: Sort, Group

10 posts, 1 answers
  1. Thiam Chye
    Thiam Chye avatar
    8 posts
    Member since:
    Sep 2012

    Posted 08 Apr 2013 Link to this post

    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!
  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 09 Apr 2013 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
  4. Thiam Chye
    Thiam Chye avatar
    8 posts
    Member since:
    Sep 2012

    Posted 09 Apr 2013 Link to this post

    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!
  5. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 09 Apr 2013 Link to this post

    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!
  6. Thiam Chye
    Thiam Chye avatar
    8 posts
    Member since:
    Sep 2012

    Posted 09 Apr 2013 Link to this post

    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.
  7. Answer
    Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 09 Apr 2013 Link to this post

    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!
  8. Volker
    Volker avatar
    22 posts
    Member since:
    Jul 2013

    Posted 28 Mar 2014 Link to this post

    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...
  9. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 28 Mar 2014 Link to this post

    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!
     
  10. Volker
    Volker avatar
    22 posts
    Member since:
    Jul 2013

    Posted 01 Apr 2014 in reply to Atanas Korchev Link to this post

    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.


  11. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 01 Apr 2014 Link to this post

    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!
     
Back to Top
Kendo UI is VS 2017 Ready