hello, i have this condition,
My Tables are:
+----------------------------+ | tbl_training | +----------------------------+ |kd_training | nama_training | +------------+---------------+ | 0001 | 1st training | | 0002 | 2nd training | | 0003 | 3rd training | +------------+---------------+ +-----------------------------------+ | tbl_batch_training | +-----------------------------------+ | kd_batch | kd_training | no_batch | +----------+-------------+----------+ | A | 0001 | 1 | | B | 0001 | 2 | | C | 0002 | 1 | | D | 0002 | 2 | +----------+-------------+----------+ +--------------------------+ | tbl_assignment | +--------------------------+ | kd_assignment | kd_batch | +---------------+----------+ | A1 | A | | A2 | C | | A3 | D | +---------------+----------+
on my controller:
$crud->set_table('tbl_assignment'); $crud->set_subject('Assignment'); if($state != 'edit') { $crud->callback_column('kd_batch',array($this,'_column_callback_kd_batch')); } else { $crud->set_relation('kd_batch','tbl_batch_training','{kd_training} - {no_batch}'); }
_column_callback_kd_batch:
function _column_callback_kd_batch($value, $row) { //it turns 'D' into '2nd training, Batch number 2' }
as we see there, when browsing the flexigrid, we will see the kd_batch shown '{nama_training}, batch number {no_batch}'
but, on edit/insert, it will shown 0001 - 1
instead, i want to make kd_batch on tbl_assignment listing shown:
- 1st training, Batch number 1
- 2nd training, Batch number 1
- 2nd training, Batch number 2
as a flexigrid's dropdown menu (with search box)
how to do that?