Skip to content
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

Adds ability to sort by multiple columns (multisort) #359

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

kountouris7
Copy link

@kountouris7 kountouris7 commented Dec 17, 2021

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']

michalisantoniou6 and others added 3 commits December 17, 2021 01:27
* Adds ability to sort by multiple columns (multisort)

Authored-by: Antonis Antoniou <[email protected]> and Michalis Antoniou <[email protected]>
@thyseus
Copy link
Collaborator

thyseus commented Mar 22, 2022

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 ?

@kountouris7
Copy link
Author

kountouris7 commented Mar 22, 2022

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

@kountouris7
Copy link
Author

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
@kountouris7
Copy link
Author

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

@thyseus
Copy link
Collaborator

thyseus commented Sep 9, 2022

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

@kountouris7
Copy link
Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Is it possible to sort by multiple columns?
4 participants