⚠ 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

flexgrid action buttons routes



fduque

fduque
  • profile picture
  • Member

Posted 08 December 2017 - 21:35 PM

Hi fellows

I have not understand how to set routes for action buttons on GC grid yet

Please could someone show me an example

i just having 404 page until now on action buttons click

 

 

regards

 

 


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 09 December 2017 - 16:12 PM

Well u dont need to set any routes for action buttons. You just need to set the right path. If you working on setting relative path, it can cause issue, if you set in absolute path .. it will land directly on the desired urls.

 

You may share in the piece of code here so one can look in the same and try to figure out where the issue is all over.

 

Happy GCIng :)


fduque

fduque
  • profile picture
  • Member

Posted 09 December 2017 - 18:38 PM

 
 
 
 
 
the controller
++++++++
 
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
 
class Usuario extends CI_Controller {
public function __construct(){
parent::__construct();
$this->load->library('session');
$this->load->database();
$this->load->model('users');
$this->load->helper('url');
$this->load->library('grocery_CRUD');
}
 
public function index()  
{   
       echo "<script language='javascript' type='text/javascript'>
alert('no users to show...');
document.location='/gcerp'</script>";    
} //end func
 
 
public function usercrud()
{
 
$wu = new Users();   //model users
 
  if ($wu->isloged())
  {
 
    $crud = new grocery_CRUD();
    $crud->set_crud_url_path(site_url('usuario'));
           $crud->set_table('users');
           $crud->columns('name','email');
           $crud->set_subject('Usuarios');
           $output = $crud->render();
           $this->load->view('header', $output);       // load all css and js files includind GC's
           $this->load->view('menuloged');
           $this->load->view('bodyuser', $output );
           $this->load->view('footer'); 
   }else{
header("Location: ".'/gcerp');                
     
} //end func
} // end class
 

 

the view called (bodyuser) by controller

++++++++++++++++++++++++

 

 
<div style='height:20px;'>  
      <h4>funções restritas ao nível de ascesso.</h4><br>        
</div>
    
      <?php echo $output; ?>
 
<div style='height:20px;'></div>

Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 09 December 2017 - 18:50 PM

Well, first of all, what is the URL you using to access the crud? Is it something exclusively defined in the routes to bypass the actual path or is it something you are just trying to set it up additional on the same?

 

Looking for the code, i don't really see you are using the URL like

http://localhost/usercrud ...

 

What seems to be in use is the below URL

http://localhost/usuario/usercrud 

 

If this is correct - u dont need to use that function.

If the 1st one is the case you need to surely use the function.

 

but u need to set the usage as 

$crud->set_crud_url_path(site_url('usercrud'));

 

cuz that is how the base function is being called in.


fduque

fduque
  • profile picture
  • Member

Posted 09 December 2017 - 20:40 PM

i've forgot to inform

 

$route['usuarios'] = 'usuario/usercrud';   // in routes.php

 

and does not work


fduque

fduque
  • profile picture
  • Member

Posted 09 December 2017 - 23:18 PM

Ok my friend Amit

again you were so right

i have set a piece of coad like that:

$crud->set_crud_url_path(site_url('usuario/usercrud'));

and now everything is working

 

thanks a lot


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 11 December 2017 - 04:41 AM

Happy to help... Happy GCing :)