Tuesday, November 1, 2011

Re: Implementing a search functionality

Ok, this is weird.  It does pagination, which is good.  The problem arises is that when I run the search, after it it runs again, for all of the names in the DB... on the first page the search results are displayed, but on the next, the rest of the data is displayed!  Does pagination run some other search in the background or after the fact?  This is weird, please help out.

On Tue, Nov 1, 2011 at 4:00 PM, Yves S. Garret <yoursurrogategod@gmail.com> wrote:
Ok, as I have it works.  Yay!

The thing that was tripping me up was that the pagination ran _after_ the search.

This is how view_admit_lookup is now.

    function view_admit_lookup() {
        $this->helpers['Paginator'] = array('ajax' => 'ajax');
        // provide pagination for the user.
        $this->set('provider', $this->paginate());

        // here we begin searching for whatever we need.
        if(!empty($this->data['Provider']['last_name'])) {
            $this->set('provider', $this->Provider->find('all', 
                                                            array('conditions' => 
                                                                array(
                                                                    'Provider.last_name LIKE' => $this->data['Provider']['last_name'].'%'))));
        }

        // set the title and the default layout.
        $this->set('title_for_layout', 'Admit Lookup');
        $this->layout = 'default';
    }

On Tue, Nov 1, 2011 at 1:10 PM, Yves S. Garret <yoursurrogategod@gmail.com> wrote:
Ok, one more time!

This is my view:
My model:
My controller:

Now, what happens is that when I run a search for, say, Smith, the page just refreshes with all of the stuff as it was.  I inserted debug code (lines 31 & 32) in the if-statement just to see what was going on and turns out nothing was going >_>

Should I run this after the pagination?


On Tue, Nov 1, 2011 at 11:29 AM, Jeremy Burns | Class Outfit <jeremyburns@classoutfit.com> wrote:
You're right of course. Now if you are American, it would be ironic that you understand sarcasm (or irony)!


Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 1 Nov 2011, at 15:22, Jon Bennett wrote:

I hope we all know that I was being ironic. ^^

Don't think that's irony, more sarcasm ;)

j

--
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

--
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



--
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: