⚠ 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

Relation question



Robert

Robert
  • profile picture
  • Member

Posted 12 December 2013 - 14:13 PM

I have a small problem i made a relation but the desccription i want to use is big and expands my column to much. The config â€œ $config['grocery_crud_character_limiter']  = 30; â€œ dose not work since in the column it adds only the ID. Can a callback be created to fix the problem or something ?

 

 


briggers

briggers
  • profile picture
  • Member

Posted 12 December 2013 - 16:03 PM

Yes,

 

use something like

$crud->callback_column('long_text',array($this,'_callback_trim_long_text'));

and 

function _callback_trim_long_text($value,$row)
	{
		$text = character_limiter(strip_tags($row->long_text).' ...',200);
		return wordwrap($text,80,'<br />');
	}

which should extract the first 200 characters of long text, add ... to the end of it, then wrap it at 80 characters


Robert

Robert
  • profile picture
  • Member

Posted 13 December 2013 - 06:49 AM

I have made a callback like that and even tested the code you made but it dose not work at all ... I think the problem is the relation since in the field it only adds the ID not all the text or i cant use relation and callback on the same column ... Anyone have more ideeas ?


Robert

Robert
  • profile picture
  • Member

Posted 16 December 2013 - 07:07 AM

Anyone got some idea ?