Welcome Guest, Not a member yet? Register   Sign In
Dynamic results with filtering and pagination
#1

[eluser]FabioAntunes[/eluser]
Hi there,

I've been struggling with this all day and I didn't find a solution that pleased me.

So here's the deal, I have a page where the user can filter some data, imagine I have a page displaying some students and the filters I have are:
Name-> type input text,
Student number -> type input text,
Id of the class -> type multi select. (this will generate an array with multiple values)

The user press the submit button to filter and I will get the values with POST.


Everything works great the problem is with the pagination for the filtered data, as I can't get the values passed through post so i can show let's say page two.

I tried to solve this using flashdata, but flashdata doesn't support multidimensional array, with normal session I wouldn't know when to flush it, passing the parameters through url probably is the best solution but how?
With something like this? www.myexample.com/student/filter/2/Name/John/Number/123/idclass/1/idclass/2/idclass/3

Where the first number(2) is the page and the rest the filtering parameters?


I hope I had made myself clear.

Thanks


#2

[eluser]weboap[/eluser]
this url doesnt look right:
Code:
www.myexample.com/student/filter/2/Name/John/Number/123/idclass/1/idclass/2/idclass/3

it should be

Code:
www.myexample.com/student/filter/John/123/1/2/3/6

//6 been the page # , the pagination will always add the # at the end
//and then the values in the url you can access them using the uri lib

$this->uri->segment(n)

// http://ellislab.com/codeigniter/user-guide/libraries/uri.html

echo $this->uri->segment(3); // will give you john
echo $this->uri->segment(4); // will give you 123
now i will say after you figure out what parms you are passing thru the url, then you can config your
Code:
$config['uri_segment'] = n; //where your pagination will be

//http://ellislab.com/codeigniter/user-guide/libraries/pagination.html

hope it help your url logic!
#3

[eluser]FabioAntunes[/eluser]
In your example URL you used two slashes to comment? or they really belong to the url?

One more thing, the pagination number must be always the last one? I was hoping that somehow the pagination number were the first parameter in the URL
#5

[eluser]weboap[/eluser]
corrected the slashes, sorry!
#6

[eluser]InsiteFX[/eluser]
Use POST REPLY button gives you the full editor.




Theme © iAndrew 2016 - Forum software by © MyBB