Mikegk's avatar

Removing "?page" from paginated livewire view

Hey guys 🤗,

simple question: Can mute a livewire pagination somehow so that there won't be any visible url-query changes?

I never found out how to achieve that 😬...

Thank you for any help.

0 likes
5 replies
martinbean's avatar

@mikegk Why? How is the server then supposed to know what page you want if you don’t actually indicate the page number in the URI?

1 like
Mikegk's avatar

@martinbean I'm opening a modal window that displays a result of data. I would proceed like @jlrdw suggested - but in this case I would bypass livewire. I thought there would be an easy way to prevent the url from changing...

jlrdw's avatar

Also you would have to use ajax. I load lookup tables in a server fetched partial and the URL remains on parent while paginating in child. Regular page loads, you can't just "not have" the page to go to in the url.

1 like
Gardi's avatar

And im looking for showing "?page" in url XD. livewire pagination works perfectly but it wont show the "?page" in url . it gives me an error in console says

Uncaught (in promise) TypeError: URL is not a constructor at onlyChangeThePathAndQueryString

Mikegk's avatar

Did you add the pagination trait properly inside your component @gardi ?

use Livewire\WithPagination;

class YourComponent extends Component
{

    use WithPagination;

//...
}

Please or to participate in this conversation.