Right now I do the following to paginate my model after several orders
in one view:

- I created a function sort() in my controller which does the
following:

function sort()
        {
                $order = array();
                if (($this->data['sort']['column1']) == 1)
                {
                        $order['mymodel.column1'] = 'asc';
                }
                if (($this->data['sort']['column2']) == 1)
                {
                        $order['mymodel.column2'] = 'asc';
                }
                if (($this->data['sort']['column3']) == 1)
                {
                        $order['mymodel.column3'] = 'asc';
                }
                ....
                ....

                $this->paginate = array(
                 'fields' => array(....),
                 'limit' => 100,
                 'order' => $order
                );
                $data = $this->paginate('mymodel');
                $this->set('mymodels', $data);
                $this->render('index');
        }

and in my view I have a form sending the wished order (by checkboxes)
to the sort() method.
So I overwrite my paginate array each time.
Is there a better method doing this?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to