-
Notifications
You must be signed in to change notification settings - Fork 401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: GridSort somewhat incompatible with ItemsProvider #3290
Comments
Just as a possible fix for ur sitation, we have made some extension methods that allows us to send 'nested' properties to our back-end and then sorting will work on 'complex' objects. For example: Person.Bike.Brand would result in the following SortOn query parameter: SortOn=Bike.Brand We then use expressions and reflection to be able to sort. It is with Entity framework however and also with IQueryable entities, so i am not sure if this would help. Let me know, if needed i can share some code! |
@davhdavh Aspire is already using a construction where a |
This is how I would approach the problem:
public interface ISortableColumn<TGridItem, TProp> : IBindableColumn<TGridItem, TProp> {
string? ColumnId {get; }
IComparer<TProp>? Comparer { get; }
}
|
I'm afraid I need a bit more help with the code... As said, the |
🙋 Feature Request
GridSort assumes the sorting is only possible on columns where the column expression is a
MemberExpression
to be able to apply it to an IQueryable.This means that any model used with an
ItemsProvider
must provider a Member for any sortable property, and that it must somehow map those member names to a sorting method.💁 Possible Solution
I see 2 possible solutions for this:
a. Add
GridSort
constructor that allows a arbitrary key to be used asPropertyName
, so thatSortedProperty.PropertyName
can be mapped to the custom sorting logic.b. Add an optional
ColumnKey
to each column and allow GridSort to use null forPropertyName
, but add theColumnKey
inSortedProperty
.🔦 Context
Have a complex code base where the underlying db model does not support IQueryable and columns are very dynamic.
💻 Examples
The text was updated successfully, but these errors were encountered: