⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

List - Showing data row without limitation of chars.



mavershim

mavershim
  • profile picture
  • Member

Posted 20 April 2012 - 07:01 AM

Is there a way to show on the list the complete data. I have a list and the data is being truncated.
For example on my database the data is: "This callback runs on each row. It escapes the auto column value and runs the callback." on the view it will only show "This callback runs on each row. It escapes..."

noskov.biz

noskov.biz
  • profile picture
  • Member

Posted 20 April 2012 - 17:28 PM

Hi, mavershim. I think you can do this with [b]callback_column[/b]. For example, we have the field "text_to_show" in our table. Add to your function:


$crud->callback_column('text_to_show', array($this, '_full_text'));


And write function "_full_text":

function _full_text($value, $row)
{
return $value = wordwrap($row->text_to_show, 50, "<br>", true);
}


I added 50 character limit, cause of if we have too long text, it will make too long field in the page - looks not well(( Look http://ua2.php.net/manual/en/function.wordwrap.php for more info about "wordwrap" function.

web-johnny

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 20 April 2012 - 21:07 PM

Yeap [member='noskov.biz'] is right. If you wanted just for one it is the best solution. If you like just to make the limit bigger the limitation is hardcoded so you can change it from : grocery_crud.php libary near line 247

and change the :


case 'text':
$value = $this->character_limiter(strip_tags($value),30,"...");
break;


to whatever number you like for example:

$value = $this->character_limiter(strip_tags($value),50,"...");

mavershim

mavershim
  • profile picture
  • Member

Posted 23 April 2012 - 03:23 AM

Thanks for the reply. Used what web-johnny suggested 'coz will be using it on all my views.

tomvsi

tomvsi
  • profile picture
  • Member

Posted 28 August 2012 - 02:44 AM

Thank you noskov.biz. I used your solution and it worked like a charm.

noskov.biz

noskov.biz
  • profile picture
  • Member

Posted 28 August 2012 - 06:15 AM

Hi, tomvsi! You are welcome!
Today the new stable grocery CRUD version 1.3 was released. And now we can handle the number of characters just editing the 1 line at the ./application/config/grocery_crud.php. The default is 30 characters, but you can easilly change it on what you need.

For more info about new features of grocery CRUD 1.3, please, see the change_log file or the author's topic at the forum about announcing the new version. Hope that it will be interesting and helpful for you!

Best regards!