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

sort on subgrid/GridDetailsRow

2 Answers 26 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Nick
Top achievements
Rank 1
Veteran
Nick asked on 29 Jul 2020, 12:56 AM

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 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 29 Jul 2020, 06:45 AM

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

0
Nick
Top achievements
Rank 1
Veteran
answered on 29 Jul 2020, 06:48 AM
Perfect thanks Stefan
Tags
General Discussions
Asked by
Nick
Top achievements
Rank 1
Veteran
Answers by
Stefan
Telerik team
Nick
Top achievements
Rank 1
Veteran
Share this question
or