Skip to content

Commit

Permalink
add plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
miemiedev committed Mar 22, 2013
1 parent c6b43a3 commit 0827dd4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 0 additions & 2 deletions examples/data/stockQuotePage.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"pageNo": 8,
"totalCount": 1328,
"pageSize": 50,
"items": [
{
"AMPLITUDE":0.9309,
Expand Down
14 changes: 9 additions & 5 deletions src/mmPaginator.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,21 +117,25 @@

, load: function(params){
var $el = this.$el;
var $pageSizeList = this.$pageSizeList;
var opts = this.opts;

var pageNo = params[opts.pageNoName];
if(!pageNo){
pageNo = 0;
if(pageNo === undefined){
pageNo = $el.data('pageNo');
}
$el.data('pageNo', pageNo);

var totalCount = params[opts.totalCountName];
if(!totalCount){
if(totalCount === undefined){
totalCount = 0;
}
$el.data('totalCount', totalCount);

var pageSize = params[opts.pageSizeName];
if(pageSize === undefined){
pageSize = $pageSizeList.val();
}
this.$pageSizeList.val(pageSize);

this.$totalCountLabel.html(this.formatString(opts.totalCountLabel,[totalCount]));
Expand Down Expand Up @@ -203,8 +207,8 @@
$.fn.mmPaginator.defaults = {
style: 'plain'
, totalCountName: 'totalCount'
, pageNoName: 'pageNo'
, pageSizeName: 'pageSize'
, pageNoName: 'page'
, pageSizeName: 'limit'
, pageSizeLabel: '每页{0}条'
, totalCountLabel: '共<span>{0}</span>条记录'
, pageSizeList: [10, 20, 30, 40, 50]
Expand Down

0 comments on commit 0827dd4

Please sign in to comment.