⚠ 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 is an archived forum. ⚠

  •     

profile picture

Problem with add_action



Kinetic
  • profile picture
  • Member

Posted 12 December 2014 - 10:06 AM

Hi There,

 

I have recently been introduced to Grocery Crud and am very much enjoying it. 

 

There is an issue I am having as of recent. I have created a custom action but every time the page loads it auto triggers the action. Not only that but it triggers the action for every row, when what i need it to do is post the message specific to that row when the button is clicked. Is there something I am doing wrong or is this some bug?  Thank you ahead.

 

The code: public function post()

{
$this->load->library('facebook'); 
$array = $this->facebook->get_user();
 
$this->load->database();
$this->load->helper('url');
$this->load->library('grocery_CRUD'); 
$crud = new grocery_CRUD();
$crud->set_theme('datatables');
$crud->set_table('post');
$crud->callback_column('message', array($this, '_full_text'));
 
$crud->add_action('Post', '', '','ui-icon-image',array($this,'_Post'));
$output = $crud->render();
 
$userid = $this->session->userdata('permit');
 
if($userid ){
$this->load->view('home/crudform',$output);  
}else{
redirect('/home/login');
 
}
 
}
 
function _Post($primary_key , $row)
{
 
        return $this->facebook->getPageAccess($row->message);
}