Laravel-Backpack / addons

A place for the Backpack community to talk about possible Backpack add-ons.
5 stars 2 forks source link

[Editable Columns][bug] Details row icon disappears after editing a column #39

Closed skpr-repo closed 2 years ago

skpr-repo commented 2 years ago

Bug report

What I did

I added CRUD::enableDetailsRow(); inside setup(). I added an editable_text column to the datatable (setupListOperation). When I edit the text column and hit enter, the plus sign disappears ()

I also changed the datatable buttons format (show, edit, delete), overwriting the blade file and changing the appearance. After editing the editable_text and hitting enter, the buttons show their original blade content.

This is a screenshot of the row after hitting enter: https://tinyurl.com/26bppxgb

Backpack, Laravel, PHP, DB version

When I run php artisan backpack:version the output is:

PHP VERSION:

PHP 8.1.7 (cli) (built: Jun 10 2022 12:22:48) (NTS) Copyright (c) The PHP Group Zend Engine v4.1.7, Copyright (c) Zend Technologies with Zend OPcache v8.1.7, Copyright (c), by Zend Technologies

LARAVEL VERSION:

v9.21.6@569d7a2e361895f90e66bb4e02db89c27691a0e7

BACKPACK VERSION:

5.2.2@bea3042dceb2bd2a888f67d3782908bced33938a

Operating System and Server Setup

I encountered the problem above on my Windows 10 machine, Google Chrome latest and my web server is set up using Homestead. MySql 8. composer update to the latest versions. I have a license for backpack pro, devtools and editable-columns, latest version.

Thanks

promatik commented 2 years ago

Hi @skpr-repo! Thank you for your report, indeed that is a bug in Editable Columns add-on.

I've pushed a fix for it, hopefully it will be merged soon in the next few days πŸ‘Œ We'll let you know πŸ™Œ

skpr-repo commented 2 years ago

Hi @tabacitu and @promatik are there any news about the fix? Thanks

tabacitu commented 2 years ago

@skpr-repo thanks for the bump. We're working on it! @promatik has put together a PR, tried to fix this in different ways, but we keep generating other bugs while fixing this one - it's a bit trickier that we expected. I think we've narrowed down all problems though, so we're on the right path for a complete fix - probably by the end of this week.

Thank you for your patience!

skpr-repo commented 2 years ago

Hello guys, any news about this task?

tabacitu commented 2 years ago

Thanks for the reminder @skpr-repo !

@promatik can you please take another look ASAP? It's in https://github.com/Laravel-Backpack/editable-columns/pull/55 - correct?

tabacitu commented 2 years ago

@skpr-repo , sorry it took so long to fix this. But it's finally over πŸŽ‰ @promatik just figured out how we can fix this for good, and we have. We've just pushed v2.0.8 of editable-columns, which has this fixed, so a composer update backpack/editable-columns should do it for you.

Let us know if you're still seeing it afterwards - you shouldn't.

Cheers!

skpr-repo commented 2 years ago

Thank you guys, the problem has been solved!

I have just one little question, if I may ask:

I customized the right "Action buttons" this way:

<!-- resources\views\vendor\backpack\crud\buttons\show.blade.php -->
    @if(Str::contains(Route::currentRouteName(), '.search'))
    <a href="{{ url($crud->route.'/'.$entry->getKey().'/show') }}" class="btn btn-sm btn-link" data-toggle="tooltip" title="{{ trans('backpack::crud.preview') }}"><i class="la la-eye"></i></a>
    @else
    <a href="{{ url($crud->route.'/'.$entry->getKey().'/show') }}" class="btn btn-sm btn-link"><i class="la la-eye"> {{ trans('backpack::crud.preview') }}</i></a>
    @endif

This way I can hide the labels into the datatable and show them inside the "show" view.

As you can see in this short video, the left "plus" icon problem has been solved, but the right "Action buttons" have the wrong behaviour. https://www.awesomescreenshot.com/video/11064038?key=96bad1388dde88a23274633598a964b6

It seems to me that they are reloaded serverside and the @if fails because the route has been changed.

In fact, if I switch the @if this way it works:

@if(Str::contains(Route::currentRouteName(), '.show'))
    <a href="{{ url($crud->route.'/'.$entry->getKey().'/show') }}" class="btn btn-sm btn-link"><i class="la la-eye"> {{ trans('backpack::crud.preview') }}</i></a>
    @else
    <a href="{{ url($crud->route.'/'.$entry->getKey().'/show') }}" class="btn btn-sm btn-link" data-toggle="tooltip" title="{{ trans('backpack::crud.preview') }}"><i class="la la-eye"></i></a>
    @endif

I wonder if there is a better way to hide the action buttons labels inside the datatable and show them elsewhere.

Thanks!

promatik commented 2 years ago

Hi @skpr-repo! Yes, that is no a reliable way to change/hide labels.

You can either do it with you second code example, with the show, or with the first, search, but you need to add minor-update to your validation too.


I remember some months ago I suggested a change to the HTML, where we would introduce a <span> containing the text, and that way we could show/hide with CSS, @tabacitu should we do it? I don't remember why we haven't done it ...

skpr-repo commented 2 years ago

thanks! <span> tag => good idea.