Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

partabsaifzakir's avatar

Can't See All Option In Dropdown Because Of Pagination

I'm using Laravel 5.7 & VueJs 2.5.* ...

I did pagination for my invoice as well as vendor table. i have a create invoice form in which i have dropdown option for selecting vendors, i have more than 20 vendors, after doing pagination i see in my form i have only 10 vendors in my dropdown option... I don't know how to fix this issue.

Did Pagination Like this:

In HTML

    <!--PAGINATION FOR VENDORS TABLE -->
    <pagination :data="ticketInvoices" @pagination-change-page="getResults"></pagination>

    <!--PAGINATION FOR VENDORS TABLE -->
    <pagination :data="vendors" @pagination-change-page="getResults"></pagination>

methods:{} of both pagination

    //METHOD FOR INVOICE
    getResults(page = 1) {
      axios.get("api/ticket-invoice?page=" + page).then(response => {
        this.ticketInvoices = response.data;
      });
    },

    //METHOD FOR VENDOR
    getResults(page = 1) {
      axios.get("api/vendor?page=" + page).then(response => {
        this.vendors = response.data;
      });
    },

InvoiceController & VendorController

    /*Invoice Controller*/
    class TicketInvoiceController extends Controller
    {
        public function index()
        {
            $ticketInvoices = TicketInvoice::orderBy('created_at', 'desc')->paginate(10);
            return $ticketInvoices;
        }

    /*Invoice Controller*/
    class VendorController extends Controller
    {
        public function index()
        {
            $vendor = Vendor::paginate(10);
            return $vendor;
        }

Before Pagination enter image description here

After Pagination

enter image description here

0 likes
6 replies
Cronix's avatar

You obviously wouldn't paginate the vendors that you use in the dropdown. The code is doing exactly what you're telling it to do - get a batch of 10 vendors. Get them all() for the dropdown, not just some of them.

Tickets - paginate, Vendors - all.

jlrdw's avatar

If you have a large number, you could use a modal popup lookup table. You could even provide a search. Imagine there being 20,000, and user only needs vendors that start with Da for example. SO a search box user types in da, and show only that.

Results like dave, davis, davey, etc.

Or even an auto complete feature.

partabsaifzakir's avatar

@JLRDW - @CRONIX - Brother if i did vendor->all() i have a component for vendor in which i have a table of vendor data i have to paginate that. also i have a dropdown of ticket_invoice_noin another component where i'm also getting only 10 results coz i'm paginating Ticket->paginate(10). I think i have to go with autocomplete feature, can u help me with that ?

jlrdw's avatar

I believe Jeffrey has a video on autocomplete. I normally use a lookup table but there are many tutorials out there on autocomplete.

Please or to participate in this conversation.