Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
215
Custom sort strategy not applied for sortingExpressions
posted

I have a column defined with a custom sort strategy. That is working fine when I manually sort the column. However I added sortingExpressions so that it would be sorted in first place by default. That isn't using the custom sort strategy but instead just using the default sorting strategy. I tried adding the strategy to the object passed in for sortingExpressions but its still not calling it.

I have:

this.summaryGrid.sortingExpressions = 
[{fieldName: 'formattedModifiedDate'dir: SortingDirection.Descstrategy: this.gridHelperService.stringDateSortStrategy}];
and column definition
<igx-column field="formattedModifiedDate" header="Modified Date" width="160" [sortStrategy]="gridHelperService.stringDateSortStrategy"></igx-column>
               
The sorting is applied to the column by using sortingExpressions just the order is wrong and by debug I can see it never calls to my stringDateSortStrategy. When I click the column header for sorting it works properly and my sort is called.

How can I use my custom sort strategy with the sortingExpressions?

Thanks

Parents
No Data
Reply
  • 740
    Offline posted

    Hello Katy,

    Thank you for contacting Infragistics Community!

    I have investigated the described behavior and I believe you will find the following sample I have prepared for you very helpful. As you can observe I’m passing a custom sorting strategy to the MarketNotion column. In order to be able to understand easier how this custom strategy operates I have templated the cells of the MarketNotion column so that on the left side you can observe the real values and on the right side - the values which is going to be compared and sorted. Using SortingExpressions I initially sort this column in descending order and I pass again the custom sorting strategy. As you can observe this is working exactly as expected and the custom strategy is applied. If this sample is not an accurate demonstration of what you are trying to achieve please feel free to modify it and send it back to me for further investigation.

    Looking forward to hearing from you.

    Best Regards,
    Martin Evtimov
    Entry Level Software Developer
    Infragistics, Inc.

Children