Thomaus:

Can you show us some of your code? I think the Tilen's solution is
correct and you can see the PaginatorHelper::sort() method defined
here:

http://api.cakephp.org/view_source/paginator-helper/#line-293

and I don't think the depth of the search affects it's output.

-DK

On Jun 9, 9:28 am, thomaus <[email protected]> wrote:
> Hi, first thanks a lot for answering.
>
> I just tried what you said, and it doesn't work either...
>
> On Jun 1, 9:54 pm, Tilen Majerle <[email protected]> wrote:
>
>
>
>
>
>
>
> > no..in view just this
>
> > $paginator->sort('title', 'RelatedModelName.fieldName');
> > --
> > Lep pozdrav, Tilen Majerlehttp://majerle.eu
>
> > 2011/6/1 thomaus <[email protected]>
>
> > > What I do right now is something like
>
> > > 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 <[email protected]> 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 <[email protected]>
>
> > > > > 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 <[email protected]> wrote:
> > > > > > Nobody no clue?
>
> > > > > > On May 19, 7:55 pm, thomaus <[email protected]> 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 <[email protected]> wrote:
>
> > > > > > > > check the core cake's containable behaviorhttp://
> > > > > book.cakephp.org/view/1323/Containable
> > > > > > > > --
> > > > > > > > Lep pozdrav, Tilen Majerlehttp://majerle.eu
>
> > > > > > > > 2011/5/19 thomaus <[email protected]>
>
> > > > > > > > > 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
> > > > > > > > > [email protected] 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.organdhelp
> > > > > others with their CakePHP related questions.
>
> > > > > To unsubscribe from this group, send email to
> > > > > [email protected] 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.organdhelp
> > > others with their CakePHP related questions.
>
> > > To unsubscribe from this group, send email to
> > > [email protected] 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
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to