New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

callback_read_field #353

Closed
arpunpun opened this Issue Mar 23, 2016 · 4 comments

Comments

Projects
None yet
4 participants
@arpunpun
Copy link

arpunpun commented Mar 23, 2016

Why there are no API for read field callback but in library have callback_read_field

Can add callback_read_field in new version?

REF!!!!!!!!!!!!!!!!!!!!!

@moonvader

This comment has been minimized.

Copy link

moonvader commented Nov 23, 2017

same question - why there is no function for this?

@scoumbourdis

This comment has been minimized.

Copy link
Owner

scoumbourdis commented Nov 24, 2017

Hello guys, I didn't do that on purpose :)

I will include it to the next version. I will let you know once this will be available. Anyone volunteering it to test it? 😄

Regards
Johnny

@Akshay-Hegde

This comment has been minimized.

Copy link

Akshay-Hegde commented Nov 24, 2017

callback_read_field - for read state (status code : 18),
which will execute say you got url

http://yourhost.domain.com/controller/method/read/1

Here is example code

/*
 You get  value, primary_key, field_info, field_values
*/
function _get_status($value, $primary_key, $field_info, $field_values)	
{   
   
   // see whats there
  // print_r(func_get_args()); die();

   $status = array('a' => 'alert-danger', 'b'=>'alert-success', 'c'=>'alert-info');
   return  '<div class="alert '.( isset($status[$value]) ? $status[$value] : 'alert-warning' ).'">'. $value .'</div>';     	
} 

function my_method()
{
$crud = new grocery_CRUD();
$crud->set_table('your_table');

$crud->callback_read_field('status',array($this,'_get_status'));


$output = $crud->render();
$this->_example_output($output);
}
@scoumbourdis

This comment has been minimized.

Copy link
Owner

scoumbourdis commented Nov 27, 2017

This function is now ready to be used. You can either see the commit: 34f2279 either download the latest code from master in order to confirm that this is working.

If there is someone to confirm that it is working that would be great 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment