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

[6.x] can method not working in bulk action buttons inside header #1766

Closed
eafarooqi opened this issue Nov 13, 2024 · 10 comments
Closed

[6.x] can method not working in bulk action buttons inside header #1766

eafarooqi opened this issue Nov 13, 2024 · 10 comments

Comments

@eafarooqi
Copy link
Contributor

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.9

PowerGrid

6.1.1

Laravel

11.31

Livewire

3.5.12

Alpine JS

3.12.0

Theme

Bootstrap

Describe the bug.

Can method not working in bulk action buttons inside header. I am trying to add conditional bulk actions. Rules are also not working on buttons inside header.

To Reproduce...

public function header(): array
    {
        return [
            Button::add('bulk-delete')
                ->slot('Bulk delete')
                ->class('pg-btn-white')
                ->can(false)
                ->dispatch('bulkDelete.' . $this->tableName, []),
        ];
    }

Extra information

No response

@eafarooqi eafarooqi changed the title [6.x] can not working in bulk action buttons inside header [6.x] can method not working in bulk action buttons inside header Nov 13, 2024
@jinyancool
Copy link

In 6.1.2 with livewire 3.5.12, showToggleColumns() only hides row data but not header data.

@marineusde
Copy link
Contributor

In 6.1.2 with livewire 3.5.12, showToggleColumns() only hides row data but not header data.

same problem here, its just in 6.1.2 and not in 6.1.1.

The problem is in the cols.blade.php, dont know why the semicolon should be outside the string. Line 44 has to be:

style="{{ data_get($column, 'hidden') === true ? 'display:none;' : '' }} width: max-content !important; @if (data_get($column, 'enableSort')) cursor:pointer; @endif {{ data_get($column, 'headerStyle') }}"

@luanfreitasdev
Copy link
Collaborator

@luanfreitasdev
Copy link
Collaborator

I'm still not sure about this issue.

@jinyancool
Copy link

Maybe need 6.1.3 to fix this problem. If my website using bootstrap5, can livewire-powergrid use Tailwind?

@jinyancool
Copy link

I do not know why in 6.1.2, they bring this bug back. I have seen someone have reported this bug before.

In 6.1.2 with livewire 3.5.12, showToggleColumns() only hides row data but not header data.

same problem here, its just in 6.1.2 and not in 6.1.1.

The problem is in the cols.blade.php, dont know why the semicolon should be outside the string. Line 44 has to be:

style="{{ data_get($column, 'hidden') === true ? 'display:none;' : '' }} width: max-content !important; @if (data_get($column, 'enableSort')) cursor:pointer; @endif {{ data_get($column, 'headerStyle') }}"

@jinyancool
Copy link

I do not know why in 6.1.2, they bring this bug back. I have seen someone have reported this bug before.

In 6.1.2 with livewire 3.5.12, showToggleColumns() only hides row data but not header data.

same problem here, its just in 6.1.2 and not in 6.1.1.
The problem is in the cols.blade.php, dont know why the semicolon should be outside the string. Line 44 has to be:

style="{{ data_get($column, 'hidden') === true ? 'display:none;' : '' }} width: max-content !important; @if (data_get($column, 'enableSort')) cursor:pointer; @endif {{ data_get($column, 'headerStyle') }}"

#1716

@marineusde
Copy link
Contributor

@luanfreitasdev you dont have to revert the hole branch, the bug is just in one file. I have tested and fixed it: #1768

@ALL: my suggestion is, please work in good PHP IDEs like phpstorm. The error was shown in the blade file while opening.

@eafarooqi
Copy link
Contributor Author

eafarooqi commented Nov 14, 2024

Hi,
i think we have merged two issues here. This toggle column only hides is another issue from what i have mentioned. Yes this toggle column issue needs to be fixed with the following line. The semicolon should be at the right place.

style="{{ data_get($column, 'hidden') === true ? 'display:none' : ''; }} width: max-content !important; @if (data_get($column, 'enableSort')) cursor:pointer; @endif {{ data_get($column, 'headerStyle') }}"

The issue i have mentioned is that i want to have conditional actions in the header. In the headers we are creating actions using Button Class and when we pass false to can method is still showing the action in the header.

@luanfreitasdev
Copy link
Collaborator

I did a test with cypress and changed the logic

Screen.Recording.2024-11-15.at.09.23.07.mov

#1770

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants