Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Paging Documents DataSource View modes: 
User avatar
Member
Member
snk1324 - 6/7/2011 3:57:13 PM
   
Paging Documents DataSource
Ok, I have a page that has a Google Map webpart, A filter webpart. a Documents Datasource webpart, a Repeater Webpart, and a Universal Pager webpart. The Google map webpart is a custom one that allows for a datasource to be set. I have set the data source to the Documents Datasource, and that works fine. The repeater is also set to use the same Documents Datasource, and that works fine. The Universal pager is set to the Repeater webpart and that works. What I need though is the ability for the google map to be paged as well. The datasource has several 1000 entries, and binding that to the google map doesn't work as it times out. I thought I might be able to tie the Universal Pager to the Documents Datasource, and the paging would work, but it doesn't seem to affect it. Ideas?

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 6/8/2011 1:56:19 AM
   
RE:Paging Documents DataSource
Hello,


I am not sure if I get your point. You would like to display the documents which are on the current page in the Google site map. Is that right? For example: the repeater displays items: 10-19 and the google map web part should display exactly the same documents. If you change the page by pager, it should diplay different documents, right?


Best regards,
Helena Grulichova

User avatar
Member
Member
snk1324 - 6/8/2011 6:05:40 AM
   
RE:Paging Documents DataSource
Right, let's say that repeater has 100 items, and the unipager is set to show 10 items per page. And if I am on page 3, the repeater should show items 21-30, and the map should show the same 10 items (21-30).

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 6/8/2011 7:27:19 AM
   
RE:Paging Documents DataSource
Hello,


the Google maps web part is a standard CMSRepeater control in fact. The repItems_ItemDataBound method makes the actions for the Google map. It should be possible to create a document data source, connect it to the unipager control and then connect the data source to the basic repeater and repeater for Google maps.


Best regards,
Helena Grulichova

User avatar
Member
Member
snk1324 - 6/8/2011 7:38:07 AM
   
RE:Paging Documents DataSource
Can you give me an example of how to set this up? I have all of those pieces on the page. I have the unipager pointing to the Documents Data source, and the repeater and the google map pointing to the datasource, but it doesn't seem to be doing the paging. It is just returning all the results.

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 6/13/2011 2:28:18 AM
   
RE:Paging Documents DataSource
Hi,


I am sorry for confusing. The UniPager control must be related to a viewer. It is possible to bind the Data source control to a viewer and then the Unipager control to that viewer. The Google maps repeater can be delayed and later load the data source of the viewer which is already paged.

The sample code of .ascx (a cloned GoogleMaps control):

<cms:CMSQueryDataSource ID="srcElem" runat="server" QueryName="cms.office.london" PageSize="1"  />
....
<cms:CMSRepeater ID="repItems" runat="server" EnableViewState="true" OnItemDataBound="repItems_ItemDataBound" DelayedLoading="true" StopProcessing="true" />
....
<cms:UniPager ID="UniPager2" runat="server" PageControl="test" PageSize="1" PagerMode="PostBack" >
<%-- UniPager templates ----------------------------------------------------------- --%>

<PageNumbersTemplate>

<a href="<%# Eval("PageURL") %>"><%# Eval("Page") %></a>

</PageNumbersTemplate>

<%-- UniPager templates ----------------------------------------------------------- --%>

</cms:UniPager>

<cms:BasicRepeater ID="test" runat="server" />


and the code behind (.cs):

protected override void OnInit(EventArgs e)
{
base.OnInit(e);

this.test.ItemTemplate = CMSDataProperties.LoadTransformation(this, "cms.office.simple", false);
this.test.DataSource = srcElem.DataSource;
this.test.DataBind();
}

protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
....
this.repItems.StopProcessing = false;
this.repItems.DataSource = test.DataSource;
this.repItems.DataBind();
}


I hope it will help you.


Best regards,
Helena Grulichova

User avatar
Member
Member
snk1324 - 6/13/2011 11:32:43 AM
   
RE:Paging Documents DataSource
This works, except that I have a filter control as well. Have not been able to get it to see the changes.

User avatar
Member
Member
snk1324 - 6/15/2011 3:13:17 PM
   
RE:Paging Documents DataSource
I was able to get it to work. I had a filter webpart on the page. I removed that, and just put the filter control in the layout for the google map, along with everything else.

Thanks!

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 6/16/2011 2:17:09 AM
   
RE:Paging Documents DataSource
Hello,


You are welcome. I am happy it works for you now.


Best regards,
Helena Grulichova

User avatar
Member
Member
katy.maffei-springbox - 2/20/2012 12:33:12 PM
   
RE:Paging Documents DataSource
Helena,

I am trying to do the same thing, but instead of using the UniPager, I'm using the build in paging properties of the repeater. Would I make the same changes as above to the control here:
/CMSWebParts/Maps/Documents/GoogleMaps.ascx and GoogleMaps.ascx.cs

Thanks,
Katy Maffei

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 2/21/2012 2:13:23 AM
   
RE:Paging Documents DataSource
Hello,


our colleague has answered this question by e-mail. For other visitors:

The easiest way would be to create custom web part (based on repeater web part) which will contain the repeater control and the basic google maps controls where you will would need to make sure that the repeaters data source (changed by pager) will be the source data for basic google maps control.

When you would like to have repeater and google maps web parts as separate web parts, then you would need to customize both web parts and let them communicate somehow. From repeater you would need to store the data on current page into request and then get the data from request in google maps web part and use it.

To be honest I haven’t tried what I’m suggesting here, but based on my best assumption, it should work. In both cases, it will require code customization and some ASP.NET programming skills.

At first I was thinking about shared documents data source web part. Both repeater and google maps web parts can use this shared data source, but the selection is controlled by pager and that pager is connected only to repeater web part not to google maps web part. Google maps web part does not support paging, so this will not work.

You can dynamically change the where condition of the google maps web part with custom macro based let’s say on what is the URL (query string), but that is not really good approach I would say, because you don’t know purely based on the page number (let’s say 2) how many documents supposed to be on one page etc. so this will not work as well.

Best regards,
Helena Grulichova