diff --git a/docs/en.md b/docs/en.md index a0a958b..46e12c8 100644 --- a/docs/en.md +++ b/docs/en.md @@ -130,6 +130,27 @@ Number of data items per page. If you want to show all pages, just set it to `null`. +### pageLink string (default ``) +`pageLink` customizes the anchor href attribute in the pagination page buttons, for SEO purposes mostly. + +By default, they use `{{INDEX}}`. + +By setting a string in `pageLink`, it becomes `{{INDEX}}`. + +If you use the special string `{{index}}` inside your `pageLink`, the link will be customized with the current index. + +Example: + +pageLink: `/mysite/products/?page={{index}}` + +will render: + +`1` + +`2` + +etc. + ### callback function(data, pagination) Used to customize item's innerHTML, will be invoked on each paging. diff --git a/examples/pagination.html b/examples/pagination.html index 02be9b9..46e13b8 100644 --- a/examples/pagination.html +++ b/examples/pagination.html @@ -41,6 +41,8 @@
+ + @@ -168,6 +170,52 @@ } }) })('demo3'); + + (function(name) { + var container = $('#pagination-' + name); + if (!container.length) return; + var sources = function () { + var result = []; + + for (var i = 1; i < 196; i++) { + result.push(i); + } + + return result; + }(); + + var options = { + dataSource: sources, + pageLink: '/mysite/products/?page={{index}}', //to show the page button href attribute + pageNumber: 5, //to show how the next/prev links are calculated + callback: function (response, pagination) { + window.console && console.log(response, pagination); + + var dataHtml = '