Hello, hope you guys can help. I dont even know how to explain this problem in a simple way and english is not my native language ;)
I have two callbacks with conflicts and I need to use the '$row->mas_doce' variable in 'mostrar_tarifa_masdoce' function, but is being replaced with the result from the 'boton_masdoce' function which generates a button for the other column. Here are the functions and a screenshot from the result.
public function mostrar_carrera($id) {
$crud = new grocery_CRUD ();
$crud->set_table ( 'usuariosxcarrera' );
$crud->where ( 'id_carrera', $id );
$crud->set_relation ( 'id_usuario', 'usuarios', 'nombre' );
$crud->callback_column ( 'mas_doce', array ($this, 'boton_masdoce' ) );
$crud->callback_column ( 'tarifa_doce_conductor', array ( $this, 'mostrar_tarifa_masdoce' ) );
$output = $crud->render ();
$data ['titulo'] = "Carreras";
$this->vista_administrar ( $output, $data );
}
function boton_masdoce($value, $row) {
if ($row->mas_doce == 'no') {
return '<form method="post" class="btn btn-primary" action="' . site_url ( 'admin/actualizar_mas_doce/' ) . '">
<input type="hidden" name="id" value=' . $row->id . ' />
<input type="hidden" name="id_carrera" value=' . $row->id_carrera . ' />
<input type="hidden" name="porcentaje_doce_conductor" value=' . $row->porcentaje_doce_conductor . ' />
<input type="hidden" name="porcentaje_doce_tienda_gerente" value=' . $row->porcentaje_doce_tienda_gerente . ' />
<input type="hidden" name="tarifa_doce_conductor" value=' . $row->tarifa_doce_conductor . ' />
<input type="hidden" name="tarifa_doce_tienda_gerente" value=' . $row->tarifa_doce_tienda_gerente . ' />
<input type="hidden" name="mas_doce" value="si" />
<input type="submit" value="<12">
</form>';
}
if ($row->mas_doce == 'si') {
return '<form method="post" class="btn btn-danger" action="' . site_url ( 'admin/actualizar_mas_doce_no/' ) . '">
<input type="hidden" name="id" value=' . $row->id . ' />
<input type="hidden" name="id_carrera" value=' . $row->id_carrera . ' />
<input type="hidden" name="mas_doce" value="no" />
<input type="submit" value=">12">
</form>';
}
else
return;
}
public function mostrar_tarifa_masdoce($value, $row) {
return $row->mas_doce;
}
