⚠ 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

Make column as link?



victor
  • profile picture
  • Member

Posted 30 October 2012 - 11:53 AM

what values may have field state?
1, 2, 3?

victor
  • profile picture
  • Member

Posted 30 October 2012 - 11:55 AM

send me please a database dump of this table.

maha
  • profile picture
  • Member

Posted 30 October 2012 - 12:02 PM

ok i sent it

victor
  • profile picture
  • Member

Posted 30 October 2012 - 12:27 PM

function projects()
{
$crud = new grocery_CRUD();
$crud->set_table('project');
$crud->columns('name','slang','tlang','numwords','price','type','pvalid','state','rate');
$crud->callback_column('rate',array($this,'_callback_action'));
$output = $crud->render();
$this->_example_output($output);
}

public function _callback_action($value, $row)
{
if($row->state == 2)
{
return '<a href="'.site_url('signup/addratting/'.$row->state).'">******</a>';
}
else
{
return '---';
}
}

it's works.[attachment=335:list.jpg]

But, there is a bug with a searching.
I think that In future versions it will be fixed.
https://github.com/scoumbourdis/grocery-crud/issues/105
you can use a datatables grid as solution

victor
  • profile picture
  • Member

Posted 30 October 2012 - 12:39 PM

or as solution you can create real empty field for example "dummy".

$crud->callback_column('dummy',array($this,'_callback_action'));
public function _callback_action($value, $row)
{
if($row->state == 2)
{
return '<a href="'.site_url('signup/addratting/'.$row->state).'">******</a>';
}
else
{
return '---';
}
}
then you will have no error

maha
  • profile picture
  • Member

Posted 30 October 2012 - 12:40 PM

first i would like to thank you very much for your effort
second
i use your code
but it display the second return only
return '---';

victor
  • profile picture
  • Member

Posted 30 October 2012 - 12:42 PM

[quote name='maha' timestamp='1351600810' post='4088']
i use your code
but it display the second return only
return '---';
[/quote]

because you have one row with value = 2.
check "show 100 rows" and you will see good result

victor
  • profile picture
  • Member

Posted 30 October 2012 - 12:44 PM

or go on last page of list))

maha
  • profile picture
  • Member

Posted 30 October 2012 - 12:48 PM

OK now it work

really I like to Appreciates your efforts

my bug was that

 function statvalue($value, $row)
{
if($value ==0)
{
return lang('new');

} elseif($value ==1)
{
return lang('Under_Subtitle');
} elseif($value ==2)
{
//$crud->add_action('rate', base_url().'images/good.png', '' ,'ui-icon-plus',array($this,'clientrate'));
return lang('finished');
}
}

finally thank you very much