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

X-Splade-Table Component Pagination Is Broken in 0.7.1 #110

Closed
MotionPhix opened this issue Nov 13, 2022 · 5 comments
Closed

X-Splade-Table Component Pagination Is Broken in 0.7.1 #110

MotionPhix opened this issue Nov 13, 2022 · 5 comments
Labels
needs more info Requires additional code example or logging

Comments

@MotionPhix
Copy link

MotionPhix commented Nov 13, 2022

configure

The picture above is from the docs. But that paginate function is not available anymore and hence the pagination is no longer working properly. Thing is, if I click on the drop down of perpageoptions and pick a number number different from default (the default is set to 5) the pagination doesn't change to the selected number. It just remains the default one.

5 list

And for the pagination to even show on the table, I have to define it on the dataset like in the picture below. What am I missing?

take_1

The picture below shows my config for contacts table

take_2

Also the custom head and body does not work. Using the same data as above, it tells me that $contact is undefined when clearly I have set the as attribute on the x-splade-table as shown below

<x-splade-table for="$contacts" as="$contact">

<x-slot name="body">
                
                <tbody class="bg-white divide-y divide-gray-200">

                    <tr class="transition-all hover:bg-gray-100">
                      <td class="px-6 py-4 whitespace-nowrap">
                        <div class="flex items-center">
                          <div class="flex-shrink-0 w-10 h-10">
                            <img
                              src="{{ asset( '/logos/' . $contact->company->logo->photo_path ) }}"
                            />
                          </div>

                          <div class="ml-4">
                            <div class="text-sm font-medium text-gray-900"> 
                              {{ $contact->firsname . ' ' . $contact->last_name
                            </div>
                            <div class="text-sm text-gray-500">
                              {{ $contact->email }}
                            </div>
                          </div>
                        </div>
                      </td>

                      <td class="px-6 py-4 whitespace-nowrap">
                        <div class="text-sm text-gray-900">Regional Paradigm Technician</div>
                        <div class="text-sm text-gray-500">Optimization</div>
                      </td>
                      <td class="px-6 py-4 whitespace-nowrap">
                        <span
                          {{-- class={{[
                            'inline-flex px-2 text-xs font-semibold leading-5 text-green-800 rounded-full',
                            active ? 'bg-green-100' : 'bg-red-100',
                          ]}} --}}
                        >
                          {{ $contact->phone->number }}
                        </span>
                      </td>
                      <td class="px-6 py-4 text-sm text-gray-500 whitespace-nowrap">
                        {{ $contact->status }}
                      </td>

                      <td class="px-6 py-4 text-sm font-medium whitespace-nowrap">
                        <Link href="{{ route('contacts.edit', $contact) }}" class="text-indigo-600 hover:text-indigo-900">
                          Edit
                        </Link>
                      </td>
                    </tr>
                    
                </tbody>
              </x-slot>
</x-splade-table>
@ifathurrohman
Copy link

Same with me, perpage option doesn't work properly

@pascalbaljet
Copy link
Contributor

The paginate method seems to work fine (there's a dedicated test for it). I've found a bug that occurs if you're using different perPage values in the paginate and perPageOptions methods, that's fixed in v0.7.4.

@pascalbaljet pascalbaljet added the needs more info Requires additional code example or logging label Nov 15, 2022
@MotionPhix
Copy link
Author

Good afternoon, after upgrading, pagination does not work still. I am getting the following error with the pagination.

wrong_fun

Need some help getting this to work

@pascalbaljet
Copy link
Contributor

Ahh I see it! You should remove the paginate method in the for() method and only call it in the configure() method.

public function for()
{
    return Contact::with(['company', 'phone']);
}

@pascalbaljet
Copy link
Contributor

As of v0.7.7, it throws an Exception to make it more obvious what's going on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info Requires additional code example or logging
Projects
None yet
Development

No branches or pull requests

3 participants