I am using yii2 gridview,
and i have a field named description
which contains all rich html text with style and format.
Now i know how to display that data in gridview and I can limit the character to be displayed in grid for that column as well
But i have 2 problems now
1) I used a function in value
property to truncate
data so i lost ability to search from description. So how can I truncate
text and be able to search in that column as well
Here is code I used
[
'format' => 'html',
'label' => 'Description',
'value' => function ($dataProvider) {
$url = $dataProvider->description;
return BaseStringHelper::truncateWords($url,30,null,true);
},
],
2)This does solve the primary problem but after i use that method i have problem with displaying images in the gridview column. I want to trim the img
tag if any from description
data and display data in gridview and be able to search as well
I hope you guys understand my question. Let me know what can i do
Thank you