[Bug]: Ordering by field in Datasource doesnt let you Sort with it #780
Replies: 7 comments
-
I think you shouldn't use orderBy in datasource, try using $sortField and $sortDirection properties https://livewire-powergrid.com/table/component-settings.html#sort-by-field-and-direction |
Beta Was this translation helpful? Give feedback.
-
but i have to sort the data before grouping, so it'll only take the cheapest link out of duplicates by site , |
Beta Was this translation helpful? Give feedback.
-
If groupBy is inside the powergrid component would it work? |
Beta Was this translation helpful? Give feedback.
-
how can put the groupby inside powergrid component? @luanfreitasdev |
Beta Was this translation helpful? Give feedback.
-
after orderBy |
Beta Was this translation helpful? Give feedback.
-
hmm i will try that! thank you |
Beta Was this translation helpful? Give feedback.
-
Hello!. I'll move this up for discussion as it's not a bug initially. We can see this as an improvement. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Have you searched through other issues to see if your problem is already reported or has been fixed?
No
Did you read the documentation?
Yes, I did not find it.
Have you tried to publish the views?
Yes - I didn't work.
Is there an error in the console?
No
PowerGrid
3.5.13
Laravel
9.x
Livewire
v2.10.5
Alpine JS
3
Theme
Tailwind 3.x, Tailwind 3.x with tailwind/forms
Describe the bug.
when you order with a field in datasource for example ->orderBy('price', 'asc') u can not sort with it in the columns() function with the ->sortable() , the sort doesnt change
To Reproduce...
data source:
return Link::whereShowToCustomers(1) ->with('orders', 'orders.projects') ->orderBy('price', 'asc') ->groupBy('site');
column :
Column::add() ->title('Price') ->field('price_formatted', 'price') ->searchable() ->sortable() ->makeInputRange() ->bodyAttribute('text-center', '') ->headerAttribute('text-center', ''),
Extra information
Beta Was this translation helpful? Give feedback.
All reactions