Metadata
- Source
- FLUID-3824
- Type
- Bug
- Priority
- Critical
- Status
- Closed
- Resolution
- Fixed
- Assignee
- Justin Obara
- Reporter
- Justin Obara
- Created
2010-11-04T10:25:54.658-0400 - Updated
2010-11-19T12:55:03.547-0500 - Versions
- N/A
- Fixed Versions
-
- 1.3
- Component
-
- Pager
Description
Steps to reproduce:
1) open the integration example of pager
http://build.fluidproject.org/infusion/integration-demos/sakai/html/pager-site-setting.html
2) Notice that there is no data, no page links, and NaN values representing the item range
3) Changing the number of items per page will cause the pager to work properly
Attachments
Comments
-
Justin Obara commented
2010-11-04T12:49:53.026-0400 "Bug Parade Infusion 1.3"
-
Harris Wong commented
2010-11-08T16:45:02.429-0500 - Took out JSON.parse from line 29, 31. The variables are already in object form, shouldn't be parsed.
- Also added a "pageSize" in the model option within fluid.paper(), pageSize is not defined at initialization and results a "NaN", then causes an error thrown by computerPageCount() in component/paper/js/Pager.js. Added "pageSize: 10" to match the initial page size of the demo page.
-
Harris Wong commented
2010-11-10T16:45:47.798-0500 JSON.parse error is only thrown on my localhost, it seems my Apache server is converting the JSON string to Objects after the Ajax called. If I run the html from my file system instead of my localhost, it does require the JSON.parse.
The "pageSize: 10" did fixed the problem, but I am not sure if this is the best way to address this. I dug a bit into the code and found out that the values from the Model aren't being merged as they should. This has something to do with the perserve policy (in Fluid.js - line 536). The condition return false for !fluid.mergePolicyIs(newPolicy, "preserve"). I think I will have to ping Antranig on this. Model has a "perserved" policy which doesn't merge.
In the demo, Model is being override with a
model: {
pageIndex: 3
},
So the pager actually starts at page 4. However, with the preserved policy, pageSize is now not set (defaulted to 10) and became undefined, which broke the demo.Should the fix be just fixing the demo? Or should there be another function that we should call to trigger pageIndex change?
-
Antranig Basman commented
2010-11-12T13:44:09.032-0500 Two separate fixes committed for the two parts of the issue - one adjusts the behaviour of the core framework mergePolicy of "preserve" and the other applies jQuery .ajax dataType of "text" to ensure that JSON data is just decoded once on all platforms (it seems that some localhost servers might synthesis a content-Type header based on the file extension, a guess based on Harris' report)
-
Anastasia Cheetham commented
2010-11-19T12:55:03.545-0500 I've reviewed the changes for this - they look sound, and should ensure that similar problems don't arise.