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

Getting 2 Sidebars or double templates when clicking links created with Menu admin

Open Ivan-DaGreat-LT opened this issue 1 year ago • 1 comments

Describe the bug I created a new menu item via the Menu admin, whenever I click the new menu item, I get the correct page but it is wrapped in the template twice. So I am seeing 2 Sidebars and 2 Headers (See attached photo) Screenshot 2024-09-03 at 4 42 09 PM

I am using the Grid/List view. I tried just returning the grid() method with no luck, and now I return the index() method with $this->grid() in the body property.

Index Method

public function index(Content $content)
    {
        return Admin::content(function (Content $content) {
            $content
                ->title('New Page')
                ->description('List of Items')
                ->breadcrumb(
                    ['text' => 'Dashboard', 'url' => '/admin'],
                    ['text' => 'New Page']
                )
                ->body($this->grid());
        });
    }

Grid Method:

protected function grid()
    {
        $grid = new Grid(new Pages());
        $grid->column('page_id', 'ID')->sortable();
        $grid->column('page_name', 'Page')->sortable();
        $grid->column('created_at', 'Created At')->display(function ($createdDate) {
            return date(DateFormat, strtotime($createdDate));
        })->sortable();
        $grid->column('updated_at', 'Updated At')->display(function ($createdDate) {
            return date(DateFormat, strtotime($createdDate));
        })->sortable();

        $grid->filter(function ($filter) {
            $filter->like('page_name', 'Page');
        });

        $grid->actions(function ($actions) {
            $actions->disableView();
        });

        $grid->batchActions(function ($batch) {
            $batch->disableDelete();  // Disable the batch delete button
        });

        return $grid;
    }

Ivan-DaGreat-LT avatar Sep 03 '24 20:09 Ivan-DaGreat-LT

Greetings, have you managed to fix this error? The same thing is happening to me. =( But when I refresh the page, the correct information is displayed.

Tech-Loyal avatar Nov 18 '24 21:11 Tech-Loyal