Welcome Guest, Not a member yet? Register   Sign In
Reflections on pagination
#1

[eluser]alvaroeesti[/eluser]
I have this scenario:


A frontpage with a form.

I first had one controller to generate that form and another one for validation, (just to avoid clogging a controller).

I would send the validated data to a Model, get the result, and from there, to the view to generate the display of rows.

So far, so good.

Then I started with wanting the pagination of those results.

On clicking the links and seeing (var dumping) what happened, they would yield empty arrays.

So, I thought it would have been because of having two controllers, as the one who creates the form (with the populated select list from a DB) was not the same one that validated the data. And the validating data controller was actually the one which would yield another view to display the results.

So, I decided to put the validation data in the first and from now, only controller. That is, part of the controller would generate me the form and the second half would validate the data.

However, the links of pagination would again deliver empty arrays.

Reflections:


when we have seen the examples of pagination, it was very easy, it would soak up the values from a table with no form in between. But in my case, there has to be a form first and this is not activated when you use the pagination tool, so it does not go through it, therefore, posted variables will have value zero that will be sent as zero to the model, returning nothing and sending nothing to the view.


Sad




Theme © iAndrew 2016 - Forum software by © MyBB