i wanted to just list out the data in the index.ctp when the user selected the company for view, all the data will have their own company, which just few company are provided. any idea to create this action?? by refreshing page and i get view the new list of data in index.ctp. thanks.
i am new to cakephp.
If what you really want is to filter (not sort) your data, you can do it with the paginate method/vars of the controller too:
$this->Model->recursive = 0; $data = $this->paginate('Model', array('OR' => array(array('Model.type' => 1), array('Model.subtype LIKE' => '%SOMETHING%')))); $this->set('data', $data);
This would create a query like this:
WHERE ((`Model`.`type` = 1) OR (`Model`.`subtype` LIKE '%SOMETHING%')
You can also pass conditions, sorting and all that straight to paginate() from the controller like so:
$this->paginate['conditions'] = array('Recipe.title LIKE' => 'a%'); $this->paginate['limit'] = 10;