livewire-datatables icon indicating copy to clipboard operation
livewire-datatables copied to clipboard

Adds ability to sort by multiple columns (multisort)

Open kountouris7 opened this issue 3 years ago • 6 comments

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.

  • $direction property in LivewireDatatable has been removed. Each column s now has its own direction, The possible values for direction are asc, 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']

kountouris7 avatar Dec 17 '21 07:12 kountouris7

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 ?

thyseus avatar Mar 22 '22 15:03 thyseus

Hello, yes i will try and resolve the conflicts asap. Thanks

kountouris7 avatar Mar 22 '22 15:03 kountouris7

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.

kountouris7 avatar Apr 06 '22 20:04 kountouris7

Hey @thyseus conflicts are now resolved. Please let me know what you think.

kountouris7 avatar Sep 09 '22 00:09 kountouris7

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 :)

thyseus avatar Sep 09 '22 06:09 thyseus

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?

kountouris7 avatar Sep 15 '22 14:09 kountouris7