Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Pagination in Pocket Query resultset?

Pranjal Shukla September 18, 2016

Many a times result set is huge and increases the page length, did anybody try implementing the same?

4 answers

1 vote
Felix Grund (Scandio)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 20, 2016

Hi Pranjal,

I had a check on this. It should be very straight-forward. I wouldn't use any library for this myself. This is my (MySQL) query:

SELECT Name, Population
FROM Country
WHERE Continent = :Continent
LIMIT :StartIndex,:PageSize

Important: this must be entered in the "Parameter Types" field: StartIndex=Integer&PageSize=Integer

In my macro, I checked the fields "Load macro dynamically", "Enable dynamic parameters" and "Use change params template". This is what I get:

image2016-9-20 11:33:10.png

With JS I can easily reload the macro for another start index:

(function() {
	var container = $('.pocketquery-dynamic-load[data-query="Pagination"]');
	var dataIndex = container.data('index');
	var data = PocketQuery.getDynamicLoadData(dataIndex);
	data.queryParameters = { Continent: 'Europe', PageSize: 10, StartIndex: 30 };
	PocketQuery.load({
			container: container,
			data: data
	});
}())

It's now very easy to build some HTML for the pagination menu. Just let me know if you need further help smile

Felix (Scandio)

Pranjal Shukla September 21, 2016
0 votes
Mediengruppe Magdeburg December 5, 2016

Solution is interesting but in our case it would be more sufficient if there would be a possibility Pranjal Shukla described the way in http://paginationjs.com/. Are there any further possibilities?

0 votes
Pranjal Shukla September 19, 2016

Felix, I did find something here http://paginationjs.com/ but trying to figure out how can i implement it. I'll look into this later today and explore. If you can help me real quick, it'd be great.

0 votes
Felix Grund (Scandio)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 19, 2016

Hi Pranjal! Haven't heard of anyone who did this yet. Nor have I tried myself. But the possibilities are there. You can write some JS in your template and use the PocketQuery.load method with a pagination parameter. Shouldn't be so difficult.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events