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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

380 views 21 10
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