livewire-datatables
livewire-datatables copied to clipboard
Adds ability to sort by multiple columns (multisort)
Hi there! Thanks for this great package. I'd like to contribute a feature that lets the user sort by multiple columns (multisort). It resolves this issue. Please take a look whenever you get a chance and let me know if you'd like me to make any changes. Thanks!
Summary This PR introduces "multisort", a feature that allows sorting datatables by multiple columns.
Key changes in LivewireDatatable class
-
Multisort can be toggled through property
$multisort. Multisort is disabled by default. -
$sort property can now hold an array when in $multisort = true.
-
$directionproperty inLivewireDatatablehas been removed. Each column s now has its own direction, The possible values for direction areasc, desc, null. Example 'column1|asc', 'column2|desc' -
New tests: In LivewireDatatableTemplateTest:
it_can_set_sort_from_property_using_column_index, it_can_set_multisort_from_property_using_array, it_can_set_sort_from_property_using_column_name_and_direction, it_can_set_sort_from_property_using_column_index_and_direction
LivewireDatatableMultisortQueryBuilderTest, PutSortToSessionTest
Update (Sept 2022):
- Fixes bug in header-no-hide.blade.php with $column['sortable']. It should have been !$column['sortable']
Hey, @kountouris7
i have sort of taken over the maintainership of livewire-datatables and would like to merge your awesome feature. Unfortunately a lot has changed in the mean time; do you think we could resolve the conflicts that happened ?
Hello, yes i will try and resolve the conflicts asap. Thanks
Hey @thyseus some tests seems to be failing in MedicOneSystems:master and it will be extremely difficult to resolve conflicts. Please let me know if i am missing something.
Hey @thyseus conflicts are now resolved. Please let me know what you think.
Wow, @kountouris7 that looks like a lot of work you have done there. Also the tests look very intense !
There are some minor style issues here : https://github.styleci.io/analyses/O3v34B
Unfortunately i am not able to put your tests to this automatic github workflow pipeline but i will try your new feature in the beginning of next week at my local office machine, run the tests there, and may merge it when everything is fine.
Thanks a lot for all that work :)
Wow, @kountouris7 that looks like a lot of work you have done there. Also the tests look very intense !
There are some minor style issues here : https://github.styleci.io/analyses/O3v34B
Unfortunately i am not able to put your tests to this automatic github workflow pipeline but i will try your new feature in the beginning of next week at my local office machine, run the tests there, and may merge it when everything is fine.
Thanks a lot for all that work :)
Hey @thyseus . Thanks. Should i take care of the style issue here or you will do that?