Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Pagination of filtered results 02 Dec 2013 11:02 #11720

Hi,

I have completed my component three months ago, and now I am doing some refinement :) I have a question/issue about pagination

Inside adminitstration, collection view, is there a way to change the pagination from default_grid.php ?

I have created a custom filter that collects a parent-id.
The parent-id is read inside default_grid.php and, out of the whole elements list, only the elements that descends from the parent-id element are shown. This works nicely but then I have a problem with the pagination, this is the scenario:

1) Normally I see my full elements list and I have a pagination with a (global) limit of 100 results, that results in a pagination of 5 pages.
2) Then I set my filter. Let's assume that the block of children of my selected parent-id is all inside page 2.
3) When I set my select, the id is sent correctly, and the elements are filtered BUT the pagination does not change its structure: page 1 becomes empty, page 2 shows the correctly filtered results, pages 3 to 5 are empty -> not a very nice result.

It seems to me that setting list.start and list.limit inside default_grid.php, when the list is filtered, does not affect the pagination. If I echo the new set values for list.limit and list.start these have the updated values, but they do not affect the jmodel.list paginated structure.

The filtering process is really simple: the parent-id is retrieved inside default_grid.php, a function computes the list of descendant items, and when rendering the resuts:
<?php
	$k = 0;

	for ($i=0, $n=count( $this->items ); $i < $n; $i++):

		$row = &$this->items[$i];
			if (in_array($row->id, $view_tree)){
................................. // <tr><td> that populate the table of results
}
		?>

Is there a way I can solve this without having to code again the whole filter?

Elena

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.067 seconds

Although I found this tool some time ago I just started learning experimenting and building this first component on Monday and now on Thursday afternoon it's already online. Although I already had a working version done with another tool this is much easier to build and at the end you have the freedom to own your own component. Once you know how to use Cook you will boost your productivity as the learning curve is really moderate compared to many other tools.
Giori (Forum)

Get Started