Sort by 'Descending' can't cancel, when I want to prevent it in actionBegin()

HI ,

Sample:  https://stackblitz.com/edit/angular-rnq2jj?file=app.component.ts

Step1: Set multiple sortSettings

Step2: Cancel the sorting in actionBegin(), when we click the grid header

Step3: The Column is sort by ascending can cancel in method, but the sort by descending one can't cancel




Attachment: Demo_72a492c7.zip

3 Replies

JC Joseph Christ Nithin Issack Syncfusion Team June 29, 2021 08:20 AM UTC

Hi Wills, 
  
Greetings from Syncfusion software, 
  
Based on your requirement you need to cancel the sorting using the `actionBegin` event of EJ2 Grid. 
  
By default, in EJ2 Grid the sorting operation occurs in three steps Ascending, Descending and clear sorting. But when we grouped a column then the column will be sorted, and it is the default behaviour of EJ2 Grid even if you do not define the column in sortSettings.  
  
In the attached sample the grid is grouped based on the `ID` column so only sort by ascending and sort by descending occurs in that column. The `Freight` column of your grid is in the descending order and when you click on the header sorting will be cleared. When sorting is cleared the `e. columnName` will be empty and the condition `e.requestType == 'sorting' && e.columnName` will fail and the line `e.cancel = true;` will not be executed leading the sorting to be cleared. 
  
If you do not want the sorting to be cleared you can achieve it by removing `e.columnName` from your condition. 
  
Regards, 
Joseph I 



WI wills June 30, 2021 02:20 AM UTC

hi Joseph,

when I remove the code ' e. columnName ' and click 'Freight'




BS Balaji Sekar Syncfusion Team July 5, 2021 01:30 PM UTC

Hi Wills, 
 
Thanks for your valuable patience. 
 
We have validated the provided information and we have confirmed it as a bug and logged the defect report “Duplicate Sort numbers showing in Grid column while prevent sort action using actionBegin event”. Thank you for taking the time to report this issue and helping us improve our product. At Syncfusion, we are committed to fixing all validated defects (subject to technological feasibility and Product Development Life Cycle ) and including the defect fix in our upcoming weekly release which is expected to be rolled out on 21st July 2021. 
    
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.    
    
 
Regards, 
Balaji Sekar 


Loader.
Up arrow icon