Closed (fixed)
Project:
Services
Version:
6.x-2.0
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
28 Jan 2010 at 16:24 UTC
Updated:
26 Oct 2010 at 23:29 UTC
Jump to comment: Most recent file
When using formatted results in the Views service, setting the 'limit' argument doesn't override the settings in the Views display.
This patch changes how the pager and limit settings are overridden:
if (empty($offset)) {
$view->set_use_pager(TRUE);
$view->set_items_per_page($limit);
}has been changed to
if (empty($offset)) {
foreach ($view->display as $display) {
$display->display_options['items_per_page'] = $limit;
$display->display_options['offset'] = $offset;
}
}| Comment | File | Size | Author |
|---|---|---|---|
| #11 | views_limit_patch-2.0.patch | 1.23 KB | karlshea |
| #8 | views_service_offset.patch | 1.14 KB | karlshea |
| #6 | views_service_offset.patch | 976 bytes | karlshea |
| #1 | fix_display_limit.patch | 619 bytes | karlshea |
Comments
Comment #1
karlsheaHmmm... looks like the file attachment didn't go through? Here is the patch.
Comment #2
karlsheaActually, it looks like you need both? One seems to be for formatted results, and the other for unformatted.
Comment #3
marcingy commentedComment #4
voxpelli commentedClosed #717752: views.get ignores offset, limit if output_format set to TRUE as a duplicate of this - that issue had an alternate patch to this one - I'm unsure about both though
Comment #5
karlsheaThis is still not-functional in 2.0. I've been trying to get something working at all that covers lots of the cases, because I use both formatted and unformatted results from this service on the site I'm developing.
I'll try to wade through the views documentation, but obviously (unsurprisingly) there is some confusion as to the correct way to return ranged or paged results from a view. Does anyone actually know how this is supposed to work?
Comment #6
karlsheaThis seems to fix the offset issue with formatted results
Comment #7
karlsheaAnd that patch still doesn't include the limit functionality
Comment #8
karlsheaWhich is now included.
Views seems to ignore the items per page on the selected display, and instead uses the default display's settings. So this patch includes the above patch, plus sets items per page if $limit has a value.
Comment #9
kaw3939 commentedWhen is this going to be added to the released version? I am having the same problem and I can't get the patch to apply correctly.
Comment #10
marcingy commentedWhen a working patch has been supplied and the patch has been marked as review by the community. I personally don't use the views service so I won't be working on fixing this but will happily apply a patch one it is signed off as working.
Comment #11
karlsheaPatch for 2.0 attached.
I really would like someone else that uses this service to take a look and make sure it's working for them. I'm using both the formatted and unformatted cases and it seems to be working, but I haven't tested all of the different limit and offset combinations. Either way, it's definitely working better than before (i.e. not at all).
Comment #12
karlsheaComment #13
aaronl commentedHey guys, I applied this patch and it worked great.
Whereas before the "offset" filter was overriding the "limit" filter I wasn't getting anywhere near the response I needed.
Now it seems to be following the offset and limit filters, respectively
Ill chime back in if I get any errors or breaks while I keep working on this, but for now it seems to be working fine.
Comment #14
skyredwang#11: views_limit_patch-2.0.patch queued for re-testing.
Comment #15
kylebrowning commentedTHis is fixed in 2.2