Pagination in Pocket Query resultset?

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

4 answers

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)

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.

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.

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?

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

502 views 19 11
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you