Unplanned
Last Updated: 10 Jan 2024 14:47 by ADMIN
Peter
Created on: 22 Dec 2023 16:39
Category: Grid
Type: Feature Request
4
Ability to add custom sort expressions for data source operations

I want to add a custom sort comparer but I don't want to perform the whole sorting manually through the OnRead event.

Please allow adding custom expressions that will be applied to the query that the DataSource package does for easier customizations of the data operations.

3 comments
ADMIN
Nadezhda Tacheva
Posted on: 10 Jan 2024 14:47

Thank you for your feedback, Peter!

I've updated the status of the item.

Regards,
Nadezhda Tacheva
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources!
Peter
Posted on: 09 Jan 2024 11:35

Hi Nadezhda,

I put this already on the original ticket.. https://www.telerik.com/account/support-center/view-ticket/1635100

But the gist is to add a "SortComparer" (type: IComparer<TKey>?) property to the GridColumn, and then pass it through to the Telerik class SortDescriptorCollectionExpressionBuilder and pass it in when doing this:

queryable = queryable.Provider.CreateQuery((Expression) Expression.Call(typeof (Queryable), methodName, new Type[2]
{
  queryable.ElementType,
  lambdaExpression.Body.Type
}, queryable.Expression, (Expression) Expression.Quote((Expression) lambdaExpression)));

As an additional parameter which OrderBy, OrderByDescending, ThenBy or ThenByDescending all support.

Your OnRead bit is not appealing to me at all, it gives me a headache to even think through.

-Peter

 

ADMIN
Nadezhda Tacheva
Posted on: 09 Jan 2024 10:49

Hi Peter,

We've discussed the request with the team and we'd like to gather some additional information on the matter. Can you please share your feedback on the below questions? You will greatly help us with the evaluation.

  • How would you expect to pass the custom expression to the Grid? What API should the Grid expose to allow one to specify their desired expression for data operation such as sorting?
  • The example listed here shows how one can create a custom sort comparer and use that in the OnRead handler to perform custom sort logic. Can you please revise that and let us know if this approach will suffice so you can achieve your desired result?

Thank you in advance! I look forward to hearing from you!

Regards,
Nadezhda Tacheva
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources!