CONTROLLER:
$this->ModelName->Behaviors->attach('Containable');
$this->paginate = array(
'contain' => array(
'ModelName' => array('RelatedModelName' => array('fields' =>
array('fieldName')))
)
);
VIEW:
$paginator->sort('title', 'ModelName.RelatedModelName.fieldName');
I can get the values of the "fieldName" field but cannot sort it. What
do I do wrong?
On May 31, 7:38 pm, Tilen Majerle <tilen.maje...@gmail.com> wrote:
> look....try with this...it works to me
>
> if you are on CakePHP >= 2.0.0-alpha then do this in view:
> $this->Paginator->sort('your title', 'ModelName.fieldName');
>
> else do this
>
> $this->Paginator->sort('your title', 'ModelName.fieldName');
>
> i try this code and works for me, in asc and desc way :)...
>
> --
> Lep pozdrav, Tilen Majerlehttp://majerle.eu
>
> 2011/5/31 thomaus <tho...@saimiris.com>
>
>
>
>
>
>
>
> > I there. Nobody had this problem before? Strange...
>
> > Little reminder : on 2nd order related model pagination, only
> > ascending sorting is working with the CakePHP pagination helper.
>
> > On May 20, 2:20 pm, thomaus <tho...@saimiris.com> wrote:
> > > Nobody no clue?
>
> > > On May 19, 7:55 pm, thomaus <tho...@saimiris.com> wrote:
>
> > > > Thanks for your help. Using the containable, I could solve my problem.
>
> > > > Now I'm facing a related bug. The $paginator->sort helper on my view
> > > > only works once for the 2nd order models.
>
> > > > On the column "Test name" (which is a 1st order related model), both
> > > > ascending and descending sorting are working fine.
>
> > > > On the column "Test Language name" (which is a 2nd order related
> > > > model), only ascending sorting is working. I can never get the
> > > > descending order when clicking on the sorting link.
>
> > > > I guess this is a CakePHP bug isn't it? How can I solve that?
>
> > > > On May 19, 6:48 pm, Tilen Majerle <tilen.maje...@gmail.com> wrote:
>
> > > > > check the core cake's containable behaviorhttp://
> > book.cakephp.org/view/1323/Containable
> > > > > --
> > > > > Lep pozdrav, Tilen Majerlehttp://majerle.eu
>
> > > > > 2011/5/19 thomaus <tho...@saimiris.com>
>
> > > > > > Hi there,
>
> > > > > > I would like to paginate a model with a recursive field.
>
> > > > > > My main model is called "Result". "Result" belongsTo "Test" and
> > "Test"
> > > > > > belongsTo "Language"
>
> > > > > > What I would like to achieve is to get the field "Language.name"
> > (only
> > > > > > available in the model "Language") as a sortable field of my
> > "Result"
> > > > > > pagination. I'm pretty sure this is feasible but I can't achieve
> > it.
>
> > > > > > I think the best way to do it would be to find a way to merge the
> > > > > > "Language.name" field into the "Test" but I can't achieve it
> > neither.
>
> > > > > > Please, no "So simple! Just use CakePHP bind models!"-like answers,
> > > > > > what I need is some working code!
>
> > > > > > Thanks for helping!
>
> > > > > > --
> > > > > > Our newest site for the community: CakePHP Video Tutorials
> > > > > >http://tv.cakephp.org
> > > > > > Check out the new CakePHP Questions
> > sitehttp://ask.cakephp.organdhelp
> > > > > > others with their CakePHP related questions.
>
> > > > > > To unsubscribe from this group, send email to
> > > > > > cake-php+unsubscribe@googlegroups.com For more options, visit this
> > group
> > > > > > athttp://groups.google.com/group/cake-php
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscribe@googlegroups.com For more options, visit this group
> > athttp://groups.google.com/group/cake-php
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment