When I set a Page display with style:OpenLayers and set it to limit results to 5 and use a pager I expected that to limit the results to 5. I of course was forgetting about the limit I set in the related OpenLayers Data display at that moment. I set the limit on the related OpenLayers Data display to the same limit but as I use the pager on my View's output I see the same 5 results everytime.

I looked around quickly and don't see any mention of using a pager with OpenLayers module. Am I missing something or is this not a supported feature?


#15 OpenLayers-Views-Pager-1062650-15.patch655 bytesmgifford
Members fund testing for the Drupal project. Drupal Association Learn more


R.J. Steinert’s picture

I figured out a solution thanks to $view->old_view
Placing a "Node: nid" argument on the OpenLayers Data Display and placing the following code in the argument to return the nids:

for($i=0; $nid=$view->old_view[0]->result[$i]->nid; $i++)
$nids[] = $nid;

return implode(',', $nids);

This however does not work if AJAX is enabled... More research necessary.

R.J. Steinert’s picture

Status: Active » Fixed
R.J. Steinert’s picture

And don't forget to check "Allow multiple terms per argument."

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

rob70’s picture

Status: Closed (fixed) » Active

Same problem here: I can't get pagination to work with Openlayers data. I have a view:page displaying an openlayers map. The same view also has a block displaying node titles only. The view is set to display 50 results, and paginate. In the page template I include the block view as well as the map, and the block view is successfully paginated. The openlayers view however, always shows the same points. When I KPR the view for the map, $view->pager['use_pager'] = false, though it is on for the block.

rjstatic, I tried your node id fix, but old_view was always empty, so no way to pull node ids. Can you elaborate?

I'm attempting to paginate to help IE keep from choking on a large number of markers added to the map. Are there any other solutions?

Thanks in advance, please LMK if I can provide any more data, such as my view.

R.J. Steinert’s picture

@rob70 - I'll be tackling an OL problem this weekend. I'll write you back this weekend when I get my mind back in the OL headspace.

jayxdev’s picture

Hi ,

I want to paginate my results...
I have a view with 3 displays :Openlayerdata ,page and a block!
I have an exposed filter for the displays OLdata and page ! It's taxonomy term and it works because when i select on the list ,i have the corresponding nodes which are displayed on my map!
However ,i want that in my bloc ,the title of corresponding nodes which appear after filtering on my map ,be displayed in a grid with 3 columns and on the same page.
Arguments can't be used with blocs ...I'm looking for a solution for that for 4 days ...:/

I have also a slider on the footer which i want to display a picture corresponding to the node displayed on the map(it's a CCK of this nodes)...but i don't know how to do everything on the same page and which display type to use...?
Can you help me?

R.J. Steinert’s picture

@rob70 - I didn't get a chance to look at this over the weekend. Attach your View definition here so I can take a look at it.

@janv - It looks like you have a lot of requests there. It would help if you could break each one out in a clear way. I'm not sure if any of the requests have to with adding a pager to a map...

jayxdev’s picture

oki so i break my requests!

1 - Display map with nodes from an exposed filter on the view
2 - Display previous nodes title in a grid
3 - Display a block with pictures which is update depending the exposed filter applied to the map!

So you are saying that i don't have to use the view pager ?
What would be the best solution to do that?

best regards

rob70’s picture

@rjstatic, thanks for offering to look at my view, but I think I'm going to try to implement this solution:


@jaynv, you should have a look at that as well. it seems to achieve much of what you require.

as I have two area where I need to display the same results... a map and a block view.

@rjstatic, since you seem to be deep into this of late, can you shed some light on why paging isn't supported with the OpenLayers Data view type?

rob70’s picture

Issue tags: +paging

Enabled standard paging support by changing line 24 in openlayers_views.views.inc to

'use pager' => TRUE,

Which now allows my the Openlayers data to use it's own pager, or even a Block on the same view's pager.

Seems to be working fine, but haven't fully tested.p

R.J. Steinert’s picture

@rob70 The issue arises because of the structure of mechanisms. When looking at an OpenLayers module generated map, you are looking at a Dataset generated by a View inside of a "Preset" defined by OpenLayers which is inside of a View used for displaying. So, when you attach a pager to the View being used to Display the Preset which contains the dataset generated by another View, you have a disconnect. The pager in the View used for displaying the concoction has no way of communicating what page it's on to the View used for collecting the data to be displayed.

I just happen to find this strange old_view property on the View object being used for Display and used it as a bridge to communicate which page of data to deliver. I'm not sure of the origins of old_view but I hear down the grapevine that the Views team is making more properties and methods private on views objects so I wouldn't be surprised if this disappears/has disappeared. I'll guess that way the OpenLayers module is architected is definitely not something the merlinofchaos expected Views to be used with one view delivering another view a dataset.

jayxdev’s picture

i tried 'use pager' => TRUE,but it seems not to work :/
any others ideas for pagination?

nicoz’s picture

Component: OpenLayers Views » OL API

#11 works like a charm.

mgifford’s picture

Status: Active » Needs review
655 bytes

Ok, so this seems pretty silly, but here's a patch against the git repo.

Is this a workaround, or is this how it's supposed to work?

EDIT: It does work to add back in the pagination.

zzolo’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev
Status: Needs review » Fixed

Committed to 7.x. Please provide a patch and reopen for D6, if desired.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

aaronbauman’s picture

I opened a new issue because #15 seems to have regressed:
#1062650: How to paginate results using the Views pager?