注册 登录  
 加关注
查看详情
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

isblog主页

或许不一定要做得最多,但一定要做得最好! 能力就是一种财富,积累越多,就越体现你

 
 
 

日志

 
 

学习jquery插件之DataTables(二)  

2011-07-28 23:06:09|  分类: jquery学习 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
DataTable支持如下回调函数

回调函数名称

参数

返回值

默认

功能

fnCookieCallback

1.string: Name of the cookie defined by DataTables 2.object: Data to be stored in the cookie 3.string: Cookie expires string 4.string: Path of the cookie to set

string: cookie formatted string (which should be encoded by using encodeURIComponent())

null

当每次cookies改变时,会触发这个函数调用

fnDrawCallback

在每次tabledraw完后调用,至于做什么就看着办吧

fnFooterCallback

1.node : "TR" element for the footer 2.array array strings : Full table data (as derived from the original HTML) 3.int : Index for the current display starting point in the display array< 4.int : Index for the current display ending point in the display array 5.array int : Index array to translate the visual position to the full data array

用于在每次重画的时候修改表格的脚部

fnFormatNumber

1.int : number to be formatted

String : formatted string for DataTables to show the number

有默认的

用于在大数字上,自动加入一些逗号,分隔开

fnHeaderCallback

1.node : "TR" element for the header 2.array array strings : Full table data (as derived from the original HTML) 3.int : Index for the current display starting point in the display array 4.int : Index for the current display ending point in the display array 5.array int : Index array to translate the visual position to the full data array

用于在每次draw发生时,修改tableheader

fnInfoCallback

1.object: DataTables settings object 2.int: Starting position in data for the draw 3.int: End position in data for the draw 4.int: Total number of rows in the table (regardless of filtering) 5.int: Total number of rows in the data set, after filtering 6.string: The string that DataTables has formatted using it's own rules

string: The string to be displayed in the information element.

用于传达table信息

fnInitComplete

1.object:oSettings - DataTables settings object

表格初始化完成后调用

fnPreDrawCallback

1.object:oSettings - DataTables settings object

Boolean

用于在开始绘制之前调用,返回false的话,会阻止draw事件发生;返回其它值,draw可以顺利执行

fnRowCallback

1.node : "TR" element for the current row 2.array strings : Raw data array for this row (as derived from the original HTML) 3.int : The display index for the current table draw 4.int : The index of the data in the full list of rows (after filtering)

node : "TR" element for the current row

当创建了行,但还未绘制到屏幕上的时候调用,通常用于改变行的class风格

fnServerData

1.string: HTTP source to obtain the data from (i.e. sAjaxSource) 2.array objects: A key/value pair object containing the data to send to the server 3.function: Function to be called on completion of the data get process that will draw the data on the page.

void

$.getJSON

用于替换默认发到服务端的请求操作

fnStateLoadCallback

1.object:oSettings - DataTables settings object 2.object:oData - Object containing information retrieved from the state saving cookie which should be restored. For the exact properties please refer to the DataTables code.

Boolean - false if the state should not be loaded, true otherwise

cookies中的数据被加载前执行,可以方便地修改这些数据

fnStateSaveCallback

1.object:oSettings - DataTables settings object 2.String:sValue - a JSON string (without the final closing brace) which should be stored in the state saving cookie.

String - the full string that should be used to save the state

在状态数据被存储到cookies前执行,可以方便地做一些预操作


  评论这张
 
阅读(1372)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018