Comments (3)
- 异步分页时,totalNumber 是必须指定的,可以在第一次请求获取到 totalNumber,再实例化分页。
- 是个 Bug,已修复。
PS: 改为 one 的方式不可取,因为 one 始终只会触发一次,会造成无法再次触发事件。所以修复方案就是初始化新实例之前卸载旧的。
最后谢谢将 Bug 提出来!
from paginationjs.
追问第一个问题:
我的需求正如你所说,在通过dataSource: url
形式第一次进行异步请求,拿到第一页数据的同时也拿到了totalNumber,但是不知道该如何在实例化分页导航条前,把从异步请求获取的总页数设置为totalNumber,你的demo中只体现了请求前设置好totalNumber, 而没有体现请求数据到达后,如何将拿到的数据设置为totalNumber。还请赐教,不甚感激!
最后,谢谢你写了这么nice的开源库!:thumbsup::thumbsup::thumbsup::thumbsup::thumbsup:
from paginationjs.
Hmm...你说的这种用法有点像 #2 提到的,目前异步分页模式必须一开始指定 totalNumber,不然无法完成初始化
Pagination.js 是根据总记录数(totalNumber)和每页条数(pageSize)来产出分页形态,分页类组件都是此机制的哦,所以数据总条数变了,总页数也就变了,分页实例必须要重新生成 ...
提供一个简单的示例,看是否对你有帮助:
$.get('/data.json', function(response) {
var totalNumber = response.totalNumber;
$('#demo').pagination({
dataSource: '/data.json',
totalNumber: totalNumber,
callback: function(data, pagination){
// template method of yourself
var html = template(data);
dataContainer.html(html);
}
});
});
from paginationjs.
Related Issues (20)
- Discover typo in pagination.css HOT 1
- Pagesize attribute not working with Asynchronous http get request HOT 1
- String header position issue
- Strange URL param appears HOT 1
- Total page is always 1 page HOT 1
- custom-paginationjs can't work
- Deprecated jQuery
- Is there a way to update a pageSize?
- How to avoid adding extra 2 pages after 4 page HOT 1
- Cannot read properties of undefined (reading 'hooks') HOT 1
- How do i asynchronous in post request. HOT 1
- PageSize is not working with ajax method HOT 1
- DataSource in URL format send ajax request twice HOT 1
- Put pagination before data HOT 1
- `display: flex;` makes the pagination not centered HOT 3
- pageNumberStartWithZero works only once HOT 1
- How to handle empty data while using locator
- how to reload ajax data? HOT 1
- Whether pageSize and pageNumber can be automatically added to the request body
- current version not supporting for jquery-3.6.3 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from paginationjs.