Does data table work fine with livewire?

Does data table work fine with livewire?

valon197valon197 Posts: 1Questions: 1Answers: 0
edited June 18 in Free community support

Hello

I have trouble with datatables where i get a bug on my laravel project with livewire.|
I have setup the datatables, they work just fine, but i have like more than 1 routes where i use the data tables and when i go to for example users which has datatables, and than i go to dashboard route and click back (to users route) the data tables have double paging, filters and all other options.
Currently i dont have a test case i just want to know if this is a general livewire problem.
Cause i know what causes it, its a directive of livewire which is wire:navigate which makes the projects with an SPA feeling when navigating to other routes.
If i remove it it works fine but than the page doesnt feel like an SPA (single page application) anymore.

Best regards, Valon

Answers

  • kthorngrenkthorngren Posts: 21,336Questions: 26Answers: 4,951

    I'm not familiar with Livewire but searching the forum there are some threads with questions about Livewire. I didn't see one specific to your issue where duplicated paging, etc elements are seen.

    This thread might give you some ideas of where to look. The problem suggests that the wire:navigate technique is duplicating something. For instance it could be loading datatables.js again or its simply drawing a new instance of the table on the page.

    Kevin

  • noorynoory Posts: 1Questions: 0Answers: 0

    Please, if anyone can solve this problem, tell us the solution

  • kthorngrenkthorngren Posts: 21,336Questions: 26Answers: 4,951
    edited October 3

    @noory something in the environment is causing the duplicated elements. We will need to see the problem to help debug. Please post a link to a test case replicating the issue.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Also make sure you aren’t loading the jquery or Datatables libraries more than once.

    Kevin

Sign In or Register to comment.