⚠ 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

Show certain data with where



Mike Darling
  • profile picture
  • Member

Posted 03 December 2012 - 02:42 AM

I would like to be able to use a dropdown to allow the user to choose what type of data they see. I have a dropdown they can select from but it only shows the data for a second then reverts back to the "Default".


$type = $this->input->post('type');
$crud = new grocery_CRUD();
$crud->set_table('employees');
switch($type){

case 1:
$crud->where('jobTitle','Sales Rep');
$output = $crud->render();
break;

case 2:
$crud->where('jobTitle','VP Sales');
$output = $crud->render();
break;

case 3:
$crud->where('jobTitle','Sales Manager');
$output = $crud->render();
break;
default:

$output = $crud->render();
break;

}




$this->_example_output($output);

victor
  • profile picture
  • Member

Posted 03 December 2012 - 13:49 PM

Hi, Mike Darling and welcom to the forum. You can use the "datatables" theme. You can use also my library /topic/1067-updated-14112012-grid-view-with-dropdown-list-of-categories-in-header-library/

victor
  • profile picture
  • Member

Posted 03 December 2012 - 13:57 PM

The flexigrid theme doesn't work with this method of setting "where", because you should to use a url segment for this operations. As I see you used a $_GET (?category=5) or $_POST method as solution.