⚠ 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 forum is read-only and soon will be archived. ⚠

How to use callback_column

callback_column callback

  • Please log in to reply
No replies to this topic

#1 voriand



  • Members
  • Pip
  • 1 posts

Posted 22 August 2018 - 07:14 PM



I want to use the callback_column function to make some SQL update in the background as the rows are displayed.


This is my GC code in the view:

<?php $crud = new grocery_CRUD();
$crud->where('(status IS NULL) OR (assigned_to = '.$id.')');
$crud->columns('mobile_number', 'package_name', 'package_end_date');
$crud->field_type('mobile_number', 'readonly');
$crud->field_type('package_end_date', 'readonly');
$crud->change_field_type('contacted_by', 'hidden', $id);
$crud->change_field_type('contacted_at', 'hidden', date('Y-m-d'));
$crud->change_field_type('created_at', 'hidden');
$crud->change_field_type('modified_at', 'hidden', date('Y-m-d'));


$crud->callback_column('mobile_number', array($this,'_callback_assign_to_user_home'));

function _callback_assign_to_user_home($value, $row){

return $row->mobil_number;

$output = $crud->render();

$this->load->view('mobil.php', $output); ?>

The callback function is just a test I removed everything from it, but it still gives me:


A PHP Error was encounteredSeverity: Warning
Message: call_user_func() expects parameter 1 to be a valid callback, class 'CI_Loader' does not have a method '_callback_assign_to_user_home'
Filename: libraries/Grocery_CRUD.php
Line Number: 1867

So my question is: where exactly should I write the callback function exactly and how to call it without errors?


Thank you :)

Also tagged with one or more of these keywords: callback_column, callback

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users