ajax pager master,使用Ajax Pager设置行类

ajaxProcessing是一个回调函数,允许您返回问题中显示的数据,或者只返回总行数(ref):

ajaxProcessing: function(data, table, xhr){

if (data && data.hasOwnProperty('rows')) {

var r, row, c, d = data.rows,

// total number of rows (required)

total = data.total_rows,

// all rows: array of arrays; each internal array has the table cell data for that row

rows = '',

// len should match pager set size (c.size)

len = d.length;

// this will depend on how the json is set up - see City0.json

// rows

for ( r=0; r < len; r++ ) {

rows += '

'; // new row

// cells

for ( c in d[r] ) {

if (typeof(c) === "string") {

rows += '

' + d[r][c] + ''; // add each table cell data to row

}

}

rows += '

'; // end new row

}

// find first sortable tbody, then add new rows

table.config.$tbodies.eq(0).html(rows);

// no need to trigger an update method, it's done internally

return [ total ];

}

}

在return [ total ];之前,如果在构建字符串时尚未完成,则可以使用方法查找行并添加类名。

或者,对服务器的调用可以返回已包含应用于行(ref)的类名的HTML字符串:

ajaxProcessing: function(data, table, xhr){

if (data && data.hasOwnProperty('rows')) {

// data.rows would look something like this

// '

r0c0r0c1r1c0r1c1'

return [ data.total, $(data.rows), data.headers ];

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值