首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

学习jquery插件之DataTables(2)

2012-09-08 
学习jquery插件之DataTables(二)DataTable支持如下回调函数无无用于在每次重画的时候修改表格的脚部fnForm

学习jquery插件之DataTables(二)

DataTable支持如下回调函数

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

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发生时,修改table的header

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前执行,可以方便地做一些预操作


热点排行