Welcome Guest, Not a member yet? Register   Sign In
Problems when paginating search results
#1

[eluser]Wayne Smallman[/eluser]
Hi guys!

I've created a search tool that has pagination, and which uses the set_flashdata() function to keep track of the various pagination options between pages.

All works fine until you open an entry and then return to the results page, at which point, the pagination options vanish and the whole thing stops working.

I kind of get the idea the persistence of the pagination options are dying the moment an entry is opened. Fine. But it does this even if I have the entry open in a floating box, a la Fancy Box, or if I open the entry in a tab.

Any idea how to stop this unexpected behaviour?
#2

[eluser]boltsabre[/eluser]
I think the easiest solution would to be not to use flashdata for pagination as it's not designed for this kind of functionality, more so for displaying confirmation/success/failure messages, etc.

Is there a reason you're using flashdata?

If for whatever reason you cannot use standard uri->segment parameters (as outlined/descripbed in the user documenatation), then why not just use normal userdata instead of flashdata, as it is persistent and you won't loose it.
#3

[eluser]Otemu[/eluser]
[quote author="boltsabre" date="1358433603"]I think the easiest solution would to be not to use flashdata for pagination as it's not designed for this kind of functionality, more so for displaying confirmation/success/failure messages, etc.

Is there a reason you're using flashdata?

If for whatever reason you cannot use standard uri->segment parameters (as outlined/descripbed in the user documenatation), then why not just use normal userdata instead of flashdata, as it is persistent and you won't loose it.[/quote]

I was more or less going to say same thing but you beat me to it Tongue
#4

[eluser]Wayne Smallman[/eluser]
Hi, and thanks for the response...

[quote author="boltsabre" date="1358433603"]Is there a reason you're using flashdata?[/quote]

I'm using segments for the parameters; which, incidentally, I've had to extend using a Helper to make it work the way I need it to.

But I need something to store the query itself, which is typically the names of people, which is where set_flashdata() comes in.
#5

[eluser]Otemu[/eluser]
Have you tried $this->session->keep_flashdata('item');
"If you find that you need to preserve a flashdata variable through an additional request, you can do so using the keep_flashdata() function."

Opening a new tab will cause flashdata to be lost as this is now another server request. I am not sure why the same thing is happening with Fancy Box unless you are not using the inline feature, as ajax, iframe, etc would cause another server request.


#6

[eluser]Wayne Smallman[/eluser]
[quote author="Otemu" date="1358434834"]Have you tried $this->session->keep_flashdata('item');[/quote]I've just tried in place of flashdata() and it's made things worse by stopping pagination entirely.

I'm assuming that's not how it's supposed to be used, but the documentation isn't in the least clear on usage.
#7

[eluser]Wayne Smallman[/eluser]
Just so everyone knows, I did a Google and found that $this->session->keep_flashdata('search'); had to be placed in the receiving controller-method, and that fixed things.

Perhaps that could be included in the documentation?

Thanks.




Theme © iAndrew 2016 - Forum software by © MyBB