Hey,

that's because you need a different approach on pagination...

Try this instead:

        $this->paginate['Model1'] = array(
            'limit' => 20,
            'conditions' => $conditions,
        );
        $models1 = $this->paginate('Model1');

        $this->paginate['Model2'] = array(
            'limit' => 20,
            'conditions' => $conditions,
        );
        $models2 = $this->paginate('Model2');

        $this->paginate['Model3'] = array(
            'limit' => 20,
            'conditions' => $conditions,
        );
        $models3 = $this->paginate('Model3');

$this->set(compact('models1', 'models2', 'models3'));

With the update option within the paginator-helper like Amit said
before this should work.
If it does not work, use AJAX pagination instead and update the
desired element within the RequestHandler->isAjax() part.




On 15 Nov., 12:59, parallel32 <[email protected]> wrote:
> On a certain project I ran into the same problem with Cake and
> couldn't find an elegant solution in the time I had..so what I did was
> paginate the different models on the same page using ajax.  Probably
> not the answer you are looking for but it keeps things real simple!
>
> On Nov 13, 10:46 pm, "Arak Tai'Roth" <[email protected]> wrote:
>
>
>
>
>
>
>
> > This can't be the first time this has been tried?
>
> > On Nov 12, 5:12 pm, "Arak Tai'Roth" <[email protected]> wrote:
>
> > > Anyone have any other ideas?
>
> > > On Nov 12, 12:56 am, "Arak Tai'Roth" <[email protected]> wrote:
>
> > > > That doesn't work, it actually disabled the working pagination on the
> > > > Image model.
>
> > > > I know there is a model option that can be set in the Paginator
> > > > options, I'm wondering if it can be used for this purpose. But I have
> > > > been unable to find anything that lists how it's used and what exactly
> > > > it does or is used for.
>
> > > > On Nov 11, 9:39 pm, Amit Badkas <[email protected]> wrote:
>
> > > > > Hi,
>
> > > > > Just like you set different options for $paginate in controller's 
> > > > > action, I
> > > > > think you need to do it for helper too, something like
>
> > > > > $this->Paginator->options(array(
> > > > >                'Image' => array('update' => .................),
> > > > >                'Floorplan' => array('update' => .................)
> > > > >        ));
>
> > > > > should work.
>
> > > > > Amit
>
> > > > > PHP Applications for E-Biz:http://www.sanisoft.com
>
> > > > > On Fri, Nov 12, 2010 at 8:00 AM, Arak Tai'Roth 
> > > > > <[email protected]>wrote:
>
> > > > > > Hey everyone,
>
> > > > > > I have what I thought was a simple problem, but haven't been able to
> > > > > > find anything regarding it. Everything I can find is based off of
> > > > > > paginating different sets of data but all from the same model.
>
> > > > > > I have two models that are related to the model that the view is 
> > > > > > based
> > > > > > off of. So I have a view that shows a single product, in that
> > > > > > controller each product can have multiple images and multiple
> > > > > > floorplans, as such:
>
> > > > > > var $hasMany = array(
> > > > > >        'Image' => array(
> > > > > >                'className' => 'Image',
> > > > > >                'dependant' => true,
> > > > > >                'exclusive' => true
> > > > > >        ),
> > > > > >        'Floorplan' => array(
> > > > > >                'className' => 'Floorplan',
> > > > > >                'dependant' => true,
> > > > > >                'exclusive' => true
> > > > > >        )
> > > > > > );
>
> > > > > > Now I am getting the data alright with the following code in my
> > > > > > Products controller:
>
> > > > > > var $paginate = array(
> > > > > >        'Image' => array(
> > > > > >                'fields' => array(
> > > > > >                        'Image.filename', 'Image.caption'
> > > > > >                ),
> > > > > >                'limit' => 3,
> > > > > >                'order' => array(
> > > > > >                        'Image.id' => 'asc'
> > > > > >                )
> > > > > >        ),
> > > > > >        'Floorplan' => array(
> > > > > >                'fields' => array(
> > > > > >                        'Floorplan.filename', 
> > > > > > 'Floorplan.floorplan_name',
> > > > > > 'Floorplan.floorplan_price'
> > > > > >                ),
> > > > > >                'limit' => 1,
> > > > > >                'order' => array(
> > > > > >                        'Floorplan.id' => 'asc'
> > > > > >                )
> > > > > >        )
> > > > > > );
>
> > > > > > $dbImages = $this->paginate('Image', array('product_id' =>
> > > > > > $dbProduct['Product']['id']));
> > > > > > $dbFloorplans = $this->paginate('Floorplan', array('product_id' =>
> > > > > > $dbProduct['Product']['id']));
>
> > > > > > However the problem becomes apparent when I go to implement the
> > > > > > pagination in the view, I have to set the options for the paginator,
> > > > > > so it knows what div to update and what to do on before and complete
> > > > > > callbacks.
>
> > > > > > <?php
> > > > > >        $this->Paginator->options(array(
> > > > > >                'update' => '#showProducts',
> > > > > >                'evalScripts' => true,
> > > > > >                'before' => 
> > > > > > $this->Js->get('#image_box')->effect('fadeOut'),
> > > > > >                'complete' => 
> > > > > > $this->Js->get('#image_box')->effect('fadeIn',
> > > > > > array('speed' => 'slow'))
> > > > > >        ));
> > > > > > ?>
>
> > > > > > However, this only works for the Image model, because I need to 
> > > > > > update
> > > > > > a different div for the Floorplans model and use different before 
> > > > > > and
> > > > > > complete callbacks.
>
> > > > > > Is there anyway to do this?
>
> > > > > > Check out the new CakePHP Questions 
> > > > > > sitehttp://cakeqs.organdhelpothers
> > > > > > with their CakePHP related questions.
>
> > > > > > You received this message because you are subscribed to the Google 
> > > > > > Groups
> > > > > > "CakePHP" group.
> > > > > > To post to this group, send email to [email protected]
> > > > > > To unsubscribe from this group, send email to
> > > > > > [email protected]<cake-php%[email protected]
> > > > > >  om>For more options, visit this group at
> > > > > >http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to