SharePoint Javascript CamlQuery Paging

strQuery = “<View><Query> ………………………….</Query><RowLimit>5</RowLimit></View>”;

 

camlQuery.set_viewXml(strQuery);
if(glbNextPagingInfo){ ////”Paged=TRUE&p_GoLiveDate=20161118%2016%3a00%3a00&p_ID=12″
var position = new SP.ListItemCollectionPosition();
position.set_pagingInfo(glbNextPagingInfo);
camlQuery.set_listItemCollectionPosition(position);
}

 

var glbNextPagingInfo;

function managePagerControl() {

var footerHtml = “”;
$(“#footerShowMoreLink”).remove();

if (collListItems_Breakers.get_listItemCollectionPosition()) {
glbNextPagingInfo = collListItems_Breakers.get_listItemCollectionPosition().get_pagingInfo();

footerHtml = “<a href=\”#\” onclick=\”showMoreClick();\” id=\”footerShowMoreLink\”>[Show next ” + glbPageSize + “]</a>”;

} else {
glbNextPagingInfo = null;
}

document.getElementById(“divFooter”).innerHTML += footerHtml;

}

function showMoreClick() {
getItemsFromList();
}

 

 

//reference from : https://code.msdn.microsoft.com/sharepoint/SharePoint-JSOM-list-5104ca92

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: