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 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]<cake-php%[email protected]>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