Tags » Pagination

Membuat Pagination di Flask + MongoDB

Pertama, kita butuh flask extension yang bernama flask-paginate

https://pythonhosted.org/Flask-paginate/

Kemudian tambahkan baris berikut di route yang mau di-paginasi, misal search result:

from flask_paginate import Pagination, get_page_parameter

@app.route("/search/<keyword>")
def search(keyword):
	page = request.args.get(get_page_parameter(), type=int, default=1)
	per_page = 3
	offset = (page - 1) * per_page
	data = db.product.find({'$text': {'$search': keyword}}, {'score':
		{'$meta':
		'textScore'}}).sort([('score', {'$meta': 'textScore'})]).skip(offset).limit(per_page)

	pagination = Pagination(page=page,
		per_page=per_page,
		total=data.count(),
		css_framework='bootstrap3',
		search=False,
		record_name='products')

	keyword_title = keyword.replace('-', ' ').title()
	return render_template("search.html",
		keyword_title=keyword_title,
		data=data,
		pagination=pagination
	) 46 more words
Flask

Pagination with JPA, custom queries and Ajax update

Pagination is easy to implement using Pageable class of org.springframework.data.domain package. This example includes complete paginator with custom search queries and Ajax update of results. 1,552 more words

Java

Pure PHP/CSS Table with Sorting, Pagination, and Static Column

This PHP table can be tied into a database and used to display information from a simple select query. More advanced queries that require joins, counts, subqueries, etc. 9,575 more words

Css

Swift 3, iOS and Xcode 8: UIPageController and UIPageControl

These two elements allow you to swipe through UIViewControllers with little dots at the bottom of the screen.

First drag a UIPageController onto your storyboard. And give it a custom class. 479 more words

Swift

Deal with Rate Limit of Twitter API

I am working on a project which requires me to collect twitter data of many users (profile, followers, tweets …) by using Python. At first glance, I thought it would be easy but it turned out NOT, actually .. 431 more words

Data Scientist

City Photo Walk - Wapping to Canary Wharf

This was an opportunity to capture the Victorian architectural features of Wapping, the remains of London Docks and Tobacco Dock as we walked through Wapping Woods and Shadwell Basin towards the Thames at King Edward VI Memorial Park en-route to the modern splendour of Canary Wharf where we enjoyed lunch at Pagination in Canary Wharf. 34 more words

Home