⚠ 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 add action in flexigrid



salvomil
  • profile picture
  • Member

Posted 31 July 2013 - 06:50 AM

Hi everybody,

 

I am Salvo from Italy, so sorry for my english...

 

I am new to Crocery Crud, and I'm having problems to create  an action button ....

Well, when I use the following code in datatables theme the action button is created (but datatables theme seem does not function properly ok, that is not a problem because I can use flexigrid theme), but this does not create the button action in flexigrid....

 

....bla bla bla....

 

$this->_example_output((object)array('output' => '' , 'js_files' => array() , 'css_files' => array()));
$crud = new grocery_CRUD();
//$crud->set_theme('datatables');

$crud->set_table('news');

$crud->where('data_pubblicazione >','2012-12-31');
$crud->order_by('id','desc');
$crud->set_subject('Notizia');
$crud->columns('titolo','sottotitolo','focus','top');
$crud->fields('id','titolo','sottotitolo','testo','focus','top');
$crud->add_action('Immagini', '', '','ui-icon-image',array($this,'photos'));
$crud->change_field_type('id','invisible');
$crud->field_type('focus','true_false');
$crud->field_type('top','true_false');
$crud->field_type('active','true_false');
 
 
// and here is the callback function......
 
function photos($primary_key , $row)
{
    return(site_url().'manage/manage_controller/area_riservata/photonews/'.$row->id);
}
 
Any help..
 
Thany you

 


salvomil
  • profile picture
  • Member

Posted 31 July 2013 - 07:43 AM

Ok I read this post:

 

/topic/782-add-action-not-working/

 

and adapted my code so:

 

.......

$this->_example_output((object)array('output' => '' , 'js_files' => array() , 'css_files' => array()));
$crud = new grocery_CRUD();
 
//$crud->set_model('gc_join_model');
$crud->set_table('news');
$crud->where('data_pubblicazione >','2012-12-31');
$crud->order_by('id','desc');
$crud->set_subject('Notizia');
$crud->columns('titolo','sottotitolo','focus','top');
$crud->fields('id','titolo','sottotitolo','testo','focus','top');
$crud->change_field_type('id','invisible');
$crud->field_type('focus','true_false');
$crud->field_type('top','true_false');
$crud->field_type('active','true_false');
$crud->add_action('Immagini', '/images/preview.png', 'manage/manage_controller/photos');
 
$data['output'] = $crud->render();
$this->_example_output($data['output']);

 

 

 

 

function photos()
{
$news_id = $this->uri->segment(4);
redirect (site_url().'manage/manage_controller/area_riservata/photonews/'.$news_id);
}

 

and now it's ok.