laravel-admin icon indicating copy to clipboard operation
laravel-admin copied to clipboard

Fix pagination issues with multiple grids on one page

Open dev opened this issue 2 years ago • 2 comments

Fixes #517. If you have multiple grids on one page, with pagination, using ->paginate(), the parameter will be changed to whatever you've set using $grid->setName(). If the name was not set, 'page' will be used as fallback.

dev avatar Mar 24 '22 12:03 dev

How do you add multiple grids to one page?

iljalukin avatar Apr 14 '22 12:04 iljalukin

How do you add multiple grids to one page?

For example:

` protected function detail($id) { $show = new Show(CustomerModel::findOrFail($id));

    $show->panel()
        ->style('danger')
        ->title('title')
        ->tools(function ($tools) {
             //$tools->disableEdit();
                $tools->disableDelete();

        });
    $show->balance('balance');

        $show->customer_contact('Contact', function ($contact) { //from customer_contact relations

            $contact->panel()->tools(function ($tools) {
                $tools->disableEdit();
                $tools->disableDelete();
            });
            //$author->setResource(''); //setResource('/panel/users');

            //$contact->id();
            $contact->first_name('name');
            $contact->middle_name('m name');
            $contact->last_name('last name');
            $contact->birthdate('birtdate');
});

$show->customer_transactions('transactions',function ($transactions) { //from customer_transactions relations

        $transactions->panel()->tools(function ($tools) {
            $tools->disableEdit();
            $tools->disableDelete();
        });

        $transactions->resource('/admin/customer/transactions')->orderBy('id', 'DESC');;

        $transactions->disableActions();
        //$transactions->disablePagination(); //long list error 
        $transactions->disableCreateButton();
        //$transactions->disableFilter();
        $transactions->disableRowSelector();
        $transactions->disableColumnSelector();
        //$transactions->disableTools();
        $transactions->disableExport();
        $transactions->actions(function (Grid\Displayers\Actions $actions) {
            $actions->disableView();
            $actions->disableEdit();
            $actions->disableDelete();
        });

        //$transactions->id()->sortable();
        $transactions->description('descr')->sortable();

        $transactions->filter(function ($filter) {
            $filter->disableIdFilter();
            //$filter->between('transaction_date','date)->datetime();
            $filter->in('type', 'type)->multipleSelect(TransactionType::all()->pluck('name', 'id'));
        });
    });

    return $show;

`

glrvrl avatar May 31 '22 14:05 glrvrl