Hi GCrud'ers'
I want to add a field as a link to a page,I used the callback_column as mentioned in the GC documentation..But the edit and add operation gives no result and on the same time no errors
Im new in GC and I dont know where my error is
My controller code
public function project_management()
{
$crud = new grocery_CRUD();
$crud->set_table('project');
$crud->set_subject('Project');
$crud->set_relation('customer_id', 'customer', 'name');
$crud->display_as('customer_id','Customer Name');
$crud->set_relation('manager_id', 'resource', 'first_name');
$crud->display_as('customer_id','Customer Name');
$crud->set_relation('project_status_id', 'project_status', 'id');
$crud->display_as('project_status_id','Status Identifier');
$crud->add_fields('description','manager_id','customer_id','customer_group','project_status_id','project_status_text','redmine_id','change_date');
$crud->callback_column('redmine_id',array($this,'_callback_redmine_url'));
$crud->callback_add_field('customer_group', array($this, 'add_field_callback_1'));
$crud->callback_before_insert(array($this, '_callback_before_insert'));
$crud->callback_add_field('project_status_text', array($this, 'add_field_callback_2'));
$crud->callback_before_insert(array($this, '_callback_before_insert_2'));
$output = $crud->render();
$this->_example_output($output);
}
public function _callback_redmine_url($value, $row)
{
return "<a href='".site_url('main/project_management/'.$row->manager_id)."'>'.$row->manager_id.'</a>";
}
database
CREATE TABLE IF NOT EXISTS `project` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`project_status_id` varchar(5) COLLATE utf8_unicode_ci NOT NULL,
`manager_id` int(11) NOT NULL,
`description` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`customer_id` int(11) NOT NULL,
`redmine_id` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
`change_date` datetime DEFAULT NULL,
`attachment_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `IDX_2FB3D0EE7ACB456A` (`project_status_id`),
KEY `IDX_2FB3D0EE783E3463` (`manager_id`),
KEY `KundenProjekte` (`customer_id`),
KEY `redmine_id` (`redmine_id`),
KEY `attachment_id` (`attachment_id`),
KEY `attachment_id_2` (`attachment_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=9 ;