tags:

views:

441

answers:

2

hi,

i am having a doubt in using pagination like thing in my application..

where mytable looks like

 Entry Firstname Last Name  Residential Address Degree Gender  Submitter

 1  Aruna  Chinnamuthu MDu                   BE     Female  [email protected]
 2  Nisha  Durgaeni MS                   BE  Female  [email protected]
 3  Nathiya  N         Mumbai                   BE  Female  [email protected]

In my view i am trying to bring the First entry at first and on clicking the next link in the View it must show the Entries for the second submitter and goes on ..

I have seen the pagination concepts in book.cakephp.org. But in all those they have mentioned only to paginate by using limit and order and not by using conditions.. how to do so..

It is possible ??

My submitters is in the array as

function view($formid){

$submitters=$this->Result->find('all',array('conditions'=>array('Result.form_id'=>$formid),'group'=>array('Result.submitter_id')));

        foreach($submitters as $submitter)
        {
         echo $submitter['Result']['submitter_id'];
            } 
    }

That is i am trying to paginate by SUbmitters of my form .. Is it possible in cakephp??Please suggest me..

A: 

I think you might be looking to use the Containable behavior. That will let you specify conditions that will apply to the model's data retrievals.

I can't quite discern the rest of your code, as the formatting didn't make it from the OP very well, but I think your conditions are limited to form_id=$formid, right? I'd suggest (before that line) dynamically attaching a Containable behavior that limits the forms to just $formid.

I'm not 100% that this is what you're after, but I might be understanding the question incorrectly.

Travis Leleu
A: 

I am unsure of the CakePHP version that you are using, but in CakePHP 1.2, the Paginate method takes a second parameter. This is the conditions array:

$this->paginate('Result', array( 'id' => 1, 'someOtherCondition' => 'condition' ) );
kio