This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » General » Paging problem in 4.4 version
expandshrink

Paging problem in 4.4 version

Paging problem in 4.4 version

Tuesday 07 December 2010 12:01:46 am - 7 replies

Hi,

I've just upgraded 4.2 to 4.4 and found problem with paging when inserting file to the article:

in my Media folders are some subfolders with files. One of them contains 32 files. So I want to insert some files to my article.

Edit article > Insert/Edit object button > (popup appears) > tab "Browse" > Media > Files > some my folders > Files list

This files list contains 10 files and "Next >>". I expect that it switches to the next page and that's happening. But next page contains next 10 files and only "Previous" link (no Next link). When I click Previous, I am back on the first page. But then, when I click Next again, I can see only empty page with no files.

I think that there is a bug, or did I miss something? Did anyone struggle with that?

Aleksy

Tuesday 07 December 2010 10:00:48 am

If you take a look at the Net section of Firebug, do you see any errors in the XHR communication with the server?

Tuesday 07 December 2010 10:14:43 am

Hi Aleksy, and welcome for you first post here !

Let us know if Christian's hint helped find the issue,
Cheers,

Tuesday 07 December 2010 10:38:47 pm

If you take a look at the Net section of Firebug, do you see any errors in the XHR communication with the server?

Hi, Christian

No, there are no errors. It just look like paging could be calculated wrong. When I follow JSON messaging of POST requests, I can see that:

1. When I open the first page (10 files + pager 'Next' ), there are parameters of call:

- content.count = 10

- content.limit = 10

- content.offset = 0

- content.total_count = 28

2. When I click "Next", I see next 10 files and pager "Previous", but no "Next" (I'd expect it - the number of files is 28 in this folder). This page contains files no 9,10 from previous page on positions 1,2. And parameters are:

- content.count = 10

- content.limit = 10

- content.offset = 8 (I think it should be 10, for elements 11-20, but it explains why files 9,10 from previous page are visible here again)

- content.total_count = 28

3. When I click "Previous", I come back to first page, but I see 10 files starting from file no 3 (!). First two from step 1 are skipped. Parameters are:

- content.count = 10

- content.limit = 10

- content.offset = -2 (sure, 8 - 10 = -2 but it has to be 0)

- content.total_count = 28

4. And now... When I click again to the "Next" pager, I can see only empty page with "Next" pager shown (clicking on it takes no effect). Parameters are:

- content.count = 0 (sure, no files on the page)

- content.limit = 10

- content.offset = -210 (!!!)

- content.total_count = 28

As I see, when I click "Next" pager, offset is calculated wrong. And it is not possible to go to the pages 3, 4, ... Maybe I need to report it as a bug?

Modified on Tuesday 07 December 2010 10:47:25 pm by Aleksy Goroszko

Wednesday 08 December 2010 10:06:23 am

Hi Aleksy, yes, this sounds like a bug.

Could you please register an issue for this in http://issues.ez.no and paste the issue number into this thread?

Wednesday 11 May 2011 4:43:57 pm

Hi Aleksy, yes, this sounds like a bug.

Could you please register an issue for this in http://issues.ez.no and paste the issue number into this thread?

Well, I've check the problem and found the solution.

The problem is in browseCallBack function of eZOEPopupUtils class - there's a part with adding offset and limit variables to get the next part of list (e.g. offset value is 10 and limit is 10, we should get the sum of 20), but instead of adding integers, they join strings together (so with numbers above we will get 1010 instead 20).

This is how it looks:

if ( (data.content['offset'] + data.content['limit']) < data.content['total_count'] )
{
tag = document.createElement("a"blunk.gif Emoticon;
tag.setAttribute('href', 'JavaScript:eZOEPopupUtils.' + fn + (data.content['offset'] + data.content['limit']) + ');');

...

To fix a problem, change the code as below:

if ( (parseInt(data.content['offset']) + parseInt(data.content['limit'])) < data.content['total_count'] )
{
tag = document.createElement("a"blunk.gif Emoticon;
tag.setAttribute('href', 'JavaScript:eZOEPopupUtils.' + fn + (parseInt(data.content['offset']) + parseInt(data.content['limit'])) + ');' );
...

greetz

Lucas

Wednesday 07 December 2011 3:51:25 pm

I confirm the pagination problem and the solution proposed by Lukasz on version 4.4.

The file to be modified is

extension/ezoe/design/standard/javascript/ezoe/popup_utils.js

starting at row 840.

Thanks

Roberto

Wednesday 07 December 2011 5:09:36 pm

Hi Roberto and thanks for confirming this.

It had been reported as issue 17621 : http://issues.ez.no/17621
And fixed here : https://github.com/ezsystems/ezoe/commit/e505d505e751080c9ee6e3559f9076eb9c90f771

You may want to consider upgrading ?
An alternative is to apply the patch above, hackish though.

Cheers !

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from