Adds ability to sort by multiple columns (multisort)#359
Adds ability to sort by multiple columns (multisort)#359kountouris7 wants to merge 19 commits intoMedicOneSystems:masterfrom
Conversation
* Adds ability to sort by multiple columns (multisort) Authored-by: Antonis Antoniou <kountouris7@gmail.com> and Michalis Antoniou <michalisantoniou6@gmail.com>
|
Hey, @kountouris7 i have sort of taken over the maintainership of livewire-datatables and would like to merge your awesome feature. |
|
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. |
…nflicts_2022 # Conflicts: # README.md # resources/views/livewire/datatables/datatable.blade.php # resources/views/livewire/datatables/header-no-hide.blade.php # src/Http/Livewire/LivewireDatatable.php
# Conflicts: # CHANGELOG.md # README.md # resources/views/livewire/datatables/datatable.blade.php # resources/views/livewire/datatables/header-no-hide.blade.php # src/Http/Livewire/LivewireDatatable.php
…rom outdated master
|
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 :) |
Hey @thyseus . Thanks. Should i take care of the style issue here or you will do that? |
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
LivewireDatatableclassMultisort 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_directionLivewireDatatableMultisortQueryBuilderTest, PutSortToSessionTest
Update (Sept 2022):