⚠ 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

unset_list error



sachin vairagi
  • profile picture
  • Member

Posted 19 March 2013 - 15:24 PM

hello,

 

i am using unset_list(); in my examples controller as

 

    function offices_management()
    {
        try{
            $crud = new grocery_CRUD();

            $crud->set_theme('flexigrid');
            $crud->set_table('offices');
            $crud->set_table_title('Offices Management');
            $crud->set_subject('Office');
            $crud->required_fields('city');
            $crud->columns('city','country','phone','addressLine1','postalCode');
            $crud->change_field_type('city','readonly');
            //$crud->unset_operations();
            $crud->unset_list();
            $output = $crud->render();
            
            $this->_example_output($output);
            
        }catch(Exception $e){
            show_error($e->getMessage().' --- '.$e->getTraceAsString());
        }
    }

 

but it is giving an error

 

You don't have permissions for this operation --- #0
E:\wamp\www\ci_test\application\controllers\examples.php(46):
grocery_CRUD->render()
#1 [internal function]: Examples->offices_management()
#2 E:\wamp\www\ci_test\system\core\CodeIgniter.php(359):
call_user_func_array(Array, Array)
#3 E:\wamp\www\ci_test\index.php(202):
require_once('E:\wamp\www\ci_...')
#4 {main}

 

 

 

Please help me.


 


davidoster
  • profile picture
  • Member

Posted 19 March 2013 - 18:33 PM

When you put unset_list this prevents you from being able to see the default front page of the list.

But when you call   $this->_example_output($output); this is exactly what you are trying to do, call the list!


sachin vairagi
  • profile picture
  • Member

Posted 20 March 2013 - 04:19 AM

thanks davidoster for ur reply but i m not getting you exactly,can you please give me an example how to unset list?


victor
  • profile picture
  • Member

Posted 20 March 2013 - 09:00 AM

for example you have a function called 'books'. you can't call this function by this url localhost/books because you haven't any permissions to see that. you only can use these urls:
localhost/edit/id_ of_row
and localhost/delete/id_of_row

victor
  • profile picture
  • Member

Posted 20 March 2013 - 09:23 AM

solution :

function books ($action = null){

if ($action = 'edit' or $action = 'delete'){
$crud=......
}else others actions....

}

Rafael Alves
  • profile picture
  • Member

Posted 20 March 2013 - 21:19 PM

Or call direct the function add or edit, in their links.

Example (i use one controller per page):

 

site_url('controller_name/index/add'); 


sachin vairagi
  • profile picture
  • Member

Posted 21 March 2013 - 06:44 AM

Thanks for all your replies, i'll try it :)