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

Disable or Rename Pagination Query String. #738

Closed
wants to merge 1 commit into from
Closed

Disable or Rename Pagination Query String. #738

wants to merge 1 commit into from

Conversation

xxdalexx
Copy link

1️⃣ Is this something that is wanted/needed? Did you create a feature-request issue first?
#599
2️⃣ Does it contain multiple, unrelated changes? Please separate the PRs out.
No
3️⃣ Does it include tests if possible? (Not a deal-breaker, just a nice-to-have)
No
4️⃣ Please include a thorough description of the feature/fix and reasons why it's useful.

API

Disable query string for pagination:
Add to component
protected $paginationQueryStringEnabled = false;

Rename query string:
Declare property to use
public $differentPage;
Tell Livewire to use it
protected $paginationQueryString = 'differentPage';

@ManojKiranA
Copy link

how to handle multiple pagination in same component

@xxdalexx
Copy link
Author

Having two paginators within the same component, or having two versions of the same component on a page with different query strings?

@ManojKiranA
Copy link

Having two paginators within the same component, or having two versions of the same component on a page with different query strings?

Having Multiple Paginator Instance on Same Component or

Handling Multiple Paginator Instance on Multiple Component rendered in Same Page

@xxdalexx
Copy link
Author

I don't think the first way is possible currently, I'd have to play with around with it to see what would be involved to make it work. But you are probably better off extracting into a different component if you need two paginators.

Two components with different query strings: Rename the query string in one of them.

Multiple versions of the same component: Declare all possible query string tied variables in your component, set one as the default, and then pass in your mount() method which one to use if it's not the default. If you override the default, also call $this->initializeWithPagination(); to reset the pagination with the new query string.

@calebporzio
Copy link
Collaborator

The functionality within WithPagination is purposely extracted to an optional trait so that people can extend the functionality to meet their own needs.

I would recommend maintaining your own version of the trait locally where you modify the property name to avoid conflicts yourself.

Hopefully, that makes sense, thanks for being willing to contribute!

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.

None yet

4 participants