sort on subgrid/GridDetailsRow

3 posts, 0 answers
  1. Nick
    Nick avatar
    19 posts
    Member since:
    Oct 2019

    Posted 28 Jul 2020 Link to this post

    Hi All

    Fairly new to typescript/react

    I am trying to set the sort properties for a sub grid in a GridDetailsRow component (class DetailComponent extends GridDetailRow )

     

    I have no issue with sort setting on the parent/master grid using the state, ie:

    this.state = {
          data: productsInit,
          gridDataState: {
            sort: [{ field: "lineitemnumber", dir: "asc" }],
            page: { skip: 0, take: 100 }
          }

    }

     

    But how do I use the global state to set a different sort on subgrids?

     

    Any help would be great, thanks

  2. Stefan
    Admin
    Stefan avatar
    3034 posts

    Posted 29 Jul 2020 Link to this post

    Hello, Nick,

    This can be done by passing the additional sorting information down to the detail component together with a function that will update the parent component sort state when a detail component is sorted.

    I made an example showcasing a possible approach:

    https://stackblitz.com/edit/react-giygcf?file=app/main.jsx

    I hope this is helpful.

    Regards,
    Stefan
    Progress Telerik

  3. Nick
    Nick avatar
    19 posts
    Member since:
    Oct 2019

    Posted 29 Jul 2020 in reply to Stefan Link to this post

    Perfect thanks Stefan
Back to Top