Closed LucaMarconiItechEra closed 7 months ago
Hello there! Thanks for opening your first issue on this repo!
Just a heads-up: Here at Backpack we use Github Issues only for tracking bugs. Talk about new features is also acceptable. This helps a lot in keeping our focus on improving Backpack. If you issue is not a bug/feature, please help us out by closing the issue yourself and posting in the appropriate medium (see below). If you're not sure where it fits, it's ok, a community member will probably reply to help you with that.
Backpack communication channels:
backpack-for-laravel
tag;Please keep in mind Backpack offers no official / paid support. Whatever help you receive here, on Gitter, Slack or Stackoverflow is thanks to our awesome awesome community members, who give up some of their time to help their peers. If you want to join our community, just start pitching in. We take pride in being a welcoming bunch.
Thank you!
-- Justin Case The Backpack Robot
Hey @LucaMarconiItechEra
You have not defined the column type. The return value is a string thus it is acting as a text
column.
To show custom HTML you can use custom_html column. This has:
limit
attribute appliedescaped
by default.prefix
, suffix
& default
attributes just in case they are helpful to you.I also noticed that you want to render the model function's return value. For that, use model_function column.
I also tried the text
column and the following worked for me to dodge ellipsis:
$this->crud->column([
'name' => 'my_custom_html',
'label' => 'Custom HTML',
'type' => 'text',
'escaped' => false,
'limit' => 100,
])->value( function ($model){
return '<span class="text-danger">Something Big is coming</span>';
});
I hope this helps😊
Bug report
What I did
I'm trying to show a custom html in list operation, calling a function in model. List:
Model:
Helper:
![immagine](https://github.com/Laravel-Backpack/CRUD/assets/150908705/6f5f3ef2-1529-49dc-b98f-02fc897da32b)
What I expected to happen
I expect the outcome to be shown in full, without ... for all fields. This is abnormal behavior. I believe that by default you should always show the entire string or value and intervene to cut if necessary![immagine](https://github.com/Laravel-Backpack/CRUD/assets/150908705/6a1b70ea-4dbd-434e-960c-0a5ea8090e4b)
What happened
the ellipsis is added, even though the string is not particularly long. (in the doc I read that the default is 50)![immagine](https://github.com/Laravel-Backpack/CRUD/assets/150908705/95ad7922-dea6-4650-85b8-e4799cee6781)
What I've already tried to fix it
Adding ->limit(50) in column![immagine](https://github.com/Laravel-Backpack/CRUD/assets/150908705/15692695-1ced-4ee4-9f7c-9c673a435dba)
Is it a bug in the latest version of Backpack?
After I run
composer update backpack/crud
the bug... is it still there? YESBackpack, Laravel, PHP, DB version
When I run
php artisan backpack:version
the output is:PHP VERSION:
PHP 8.1.2-1ubuntu2.14 (cli) (built: Aug 18 2023 11:41:11) (NTS) Copyright (c) The PHP Group Zend Engine v4.1.2, Copyright (c) Zend Technologies with Zend OPcache v8.1.2-1ubuntu2.14, Copyright (c), by Zend Technologies
LARAVEL VERSION:
10.38.1.0
BACKPACK PACKAGE VERSIONS:
backpack/activity-log: 2.0.1 backpack/basset: 1.2.2 backpack/crud: 6.4.2 backpack/devtools: 3.0.4 backpack/generators: v4.0.2 backpack/logmanager: v5.0.1 backpack/permissionmanager: 7.1.1 backpack/pro: 2.0.20 backpack/revise-operation: 2.0.0 backpack/theme-tabler: 1.1.2