codeigniter - How do I make a custom-column sortable in grocery-crud -
in controller function, adding custom column called 'pc-mb', doesnot exist in database. value dynamically calculated using other values in row. works fine. question - how make column sortable. default, not sortable.
$this->load->library('grocery_crud'); $crud = new grocery_crud(); $crud->where('is_history',0); $crud->where('category',"highwaystats"); $crud->set_table('hwdata'); $crud->order_by('last_update'); $crud->set_subject('highway data'); $crud->columns('name', 'last_update', 'pc-mb'); $crud->callback_column('pc-mb',array($this, '_totalpc_callback') ); $gcrud_output = $crud->render();
it seems new field pc-mb
not exists on server side. field trying create @ runtime. in felxigrid
, observed, order set @ server side , not on client side. , since field not exists, not have effect on ordering same.
there option possible you, may opt out go on datatables themes. there have client side sorting.
if can debug on firebug or other see
500 internal server error
along texts in response this
a database error occurred
error number: 1054
unknown column 'pc-mb' in 'order clause'
select
hwdata
.*hwdata
orderpc-mb
asc limit 50
Comments
Post a Comment