- Home
- Forum
- Angular - EJ 2
- grid' sort retains after change grid group
grid' sort retains after change grid group
Hi,
I changed grid's group from "ColumnA" to "ColumnB" using "this.grid.groupColumn('ColumnB');" in ts file,
the "ColumnA" sort retained, and the sort finally become to "ColumnA, ColumnB".
I think this is a bug. I only want the sort become "ColumnB" after change group to "ColumnB", Can you fix it?
SIGN IN To post a reply.
6 Replies
1 reply marked as answer
SM
Shalini Maragathavel
Syncfusion Team
December 3, 2020 03:50 PM UTC
Hi lorryl,
Thanks for contacting Syncfusion support.
Based on your query we suspect that you are facing an issue while perform Grouping in the Grid using groupColumn() method . So we have prepared a sample and performed Grouping using groupColumn() method but we did not face the mentioned issue at our end.
For your convenience we have attached the sample and please find the sample for your reference
Sample : https://stackblitz.com/edit/angular-l2ksb8-gsbkqc?file=app.component.ts
If you are still facing the issue, kindly share the following details that will be helpful for us to provide better solution.
If you are still facing the issue, kindly share the following details that will be helpful for us to provide better solution.
1) Share your complete Grid rendering code.
2) If possible please replicate the issue in the attached sample.
3) Syncfusion package version
Regards,
Shalini M.
LO
lorryl
December 4, 2020 01:21 AM UTC
The code is below, you can test it on sample.
I know that I can ungroup first, then groun column, but this method will auto call grid load data twice from the server.
My code:
ngOnInit(): void {
this.data = inventoryData;
this.groupOptions = { columns: ['Country'],showGroupedColumn: true };
this.pageSettings = { pageCount: 5 };
}
dataBound() {
}
changegroup(){
this.groupOptions = { columns: ['Inventor'],showGroupedColumn: true };
}
After change group, the sort is wrong:
SM
Shalini Maragathavel
Syncfusion Team
December 4, 2020 03:48 PM UTC
Hi Lorryl,
Sorry for the inconvenience caused.
By default, In EJ2 Grid we can Group the multiple columns. Based on your shared code snippet, we could understood that you performed Grouping at the initial rendering of Grid and also tried to Group the another column using GroupSettings in a button click. So, Grid will consider this as multiple Grouping.
If you want to perform Grouping for a single column we suggest to clear the previous Grouped column in Grid by using clearGrouping() method and you can group the columns by using groupColumn() of Grid as demonstrated in the below code snippet.
|
App.component.html
<div class="control-section">
<button (click)="changegroup()">ungroup</button>
<button (click)="changegroup1()">group</button>
<ejs-grid #grid [dataSource]='data'>
<e-columns>
....
</e-columns>
</ejs-grid>
-------------------------------------------------
App.component.ts
export class AppComponent { ngOnInit(): void {
this.data = inventoryData;
this.groupOptions = { columns: ['Country'],showGroupedColumn: true };
this.pageSettings = { pageCount: 5 };
}
changegroup(){
this.grid.clearGrouping();
}
changegroup1(){
this.grid.groupColumn('Inventor');
} |
Please refer the below sample for more information,
Sample: https://stackblitz.com/edit/angular-l2ksb8-jgkhag?file=app.component.html
API Link: https://ej2.syncfusion.com/angular/documentation/api/grid/#cleargrouping
https://ej2.syncfusion.com/angular/documentation/api/grid/#groupcolumn
Let us know if you have any concerns.
API Link: https://ej2.syncfusion.com/angular/documentation/api/grid/#cleargrouping
https://ej2.syncfusion.com/angular/documentation/api/grid/#groupcolumn
Let us know if you have any concerns.
Regards,
Shalini M
LO
lorryl
December 7, 2020 02:01 AM UTC
I know that I can clear grouping first, then group column, but this method will auto call grid load data twice from the server.
Only this way?
LO
lorryl
December 7, 2020 07:26 AM UTC
Clear grouping will call grid get data, group column also will call grid get data. so twice.
Do you have method to solve this when change grid group?
SM
Shalini Maragathavel
Syncfusion Team
December 8, 2020 10:37 AM UTC
Hi Lorryl,
Sorry for the inconvenience caused.
Sorry for the inconvenience caused.
We have validated this case further from our end and considered this as a bug. We have logged defect report for the same as – “Sorting not removed when we change the groupSettings”. At Syncfusion, we are committed to fixing all validated defects (subject to technological feasibility and Product Development Life Cycle ) and we will include the defect fix in our upcoming weekly patch release scheduled on 16th December 2020. We appreciate your patience until then.
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.
Feedback Link: https://www.syncfusion.com/feedback/20412/sorting-not-removed-when-we-change-the-groupsettings
Regards,
Shalini M.
Marked as answer
SIGN IN To post a reply.