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

Livewire & Column Sortable #176

Open
kevintresuelo opened this issue Mar 25, 2021 · 6 comments
Open

Livewire & Column Sortable #176

kevintresuelo opened this issue Mar 25, 2021 · 6 comments

Comments

@kevintresuelo
Copy link

Hi! I've ran into an issue when @sortablelink() is placed inside a livewire component. When livewire updates its components, the link of the sortable also changes, which is replaced by some sort of fingerprint. Following code produces the error:

livewire table, using Livewire/WithPagination:

<div>
  <table>
    <thead>
      <tr>
        <th>
          @sortablelink('name', 'Name')
        </th>
      </tr>
    </thead>
    <tbody>
      @foreach($users as $user)
        <tr>...</tr>
      @endforeach
    </tbody>
  </table>
  {{ $users->links() }}
</div>

When the page first loads, the URL of the heading points to

http://localhost/users?sort=name&direction=asc

but after switching pages using Livewire's pagination, it now points to

http://localhost/livewire/message/users.users-table?fingerprint%5Bid%5D=v6Zb7qW4xmXvLXU0kghM&fingerprint%5Bname%5D=users.users-table&fingerprint%5Blocale%5D=en&fingerprint%5Bpath%5D=users&fingerprint%5Bmethod%5D=GET&serverMemo%5BhtmlHash%5D=9484b845&serverMemo%5Bdata%5D%5Bsort%5D=name&serverMemo%5Bdata%5D%5Bdirection%5D=desc&serverMemo%5Bdata%5D%5Bpage%5D=2&serverMemo%5Bchecksum%5D=1b6b1aeb0105128d0ff7a96a3f5071f5f72baaec04d7b18a49d7333f5ee415ef&updates%5B0%5D%5Btype%5D=callMethod&updates%5B0%5D%5Bpayload%5D%5Bmethod%5D=nextPage&sort=name&direction=asc
@Kyslik
Copy link
Owner

Kyslik commented Mar 25, 2021

I am not familiar with livewire; perhaps it uses some JS to manipulate DOM? I don't think I can help here.

@DanielSpindler
Copy link

DanielSpindler commented Feb 21, 2022

hey @kevintresuelo ive ran into the same issue, do you by any chance remember how you fixxed it?

@Healyhatman
Copy link
Collaborator

Best bet is probably to specify the href attribute

@DanielSpindler
Copy link

i just made it so that clicking the Sort redirects to the first page of the Table. Solved one of the Problems. (Who would want to sort midways anyway) thanks for the Suggestion @Healyhatman

@Shaka-60hp
Copy link

Shaka-60hp commented Jun 9, 2022

i just made it so that clicking the Sort redirects to the first page of the Table. Solved one of the Problems. (Who would want to sort midways anyway) thanks for the Suggestion @Healyhatman

How? could you post the solution as an example? ... Thanks

@Uryon987
Copy link

Uryon987 commented Sep 6, 2022

Got same issue, if anyone found a solution please give us a feedback :)

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

No branches or pull requests

6 participants