Power-Components / livewire-powergrid

⚡ PowerGrid generates modern, powerful and easy-to-customize data tables using Laravel Livewire.

Home Page:https://livewire-powergrid.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Getting Error Attempt to read property "placeholder" on array on toggle column

akulmehta opened this issue · comments

Have you searched through other issues to see if your problem is already reported or has been fixed?

Yes, I did not find it.

Did you read the documentation?

Yes, I did not find it.

Have you tried to publish the views?

Yes - I didn't work.

Is there an error in the console?

No

PHP Version

8.2.12

PowerGrid

5.3.7

Laravel

10.43.0

Livewire

3.4.4

Alpine JS

3.13.5

Theme

Bootstrap

Describe the bug.

When toggling fields I am getting an error of Attempt to read property "placeholder" on array in the Bootstrap input-text.blade.php file.

The line causing the issue is the following:

        $defaultPlaceholder = $column->placeholder ?: $column?->title;

When I Log the gettype on initial load, $column is an object. However, when I click on the toggle column to turn on a hidden column, $column is an array. This is probably causing the error.

I noticed that there was some changes made to how $column is accessed in PR #1356

I think in that PR, changes were made to the Tailwind filters but not to the Bootstrap filters.

For example, changing the line for the $defaultPlaceholder to

        $defaultPlaceholder = data_get($column, 'placeholder') ?: data_get($column, 'title');

fixes the issue. I will submit a PR for this.

To Reproduce...

  1. Create a PowerGrid table with Bootstrap theme and have some columns as hidden.
  2. Try to toggle the hidden column to show and you will get the error.

Extra information

<?php
 //...