dataTables基础函数变量
DataTable下有四个命名空间(namespace),分别是defaults,ext,models,oApi。
Defaults:主要是用于初始化表格的一些选项。
Ext:拓展项,提供额外的表格选项
Models:类模型容器,这些模型定义用于保存表的活动状态和信任的对象
oApi: 一些其他人开发的额外函数,引用插件开发人员使用的内部函数。
1个静态变量 version,3个静态方法:fnIsDataTable,fnTables,fnVersionCheck。
22个方法:
|
$(sSelector, oOpts) → {object} |
对table的TR elemente执行jQuery选择器操作 |
|
_(sSelector, oOpts) → {array} |
几乎与$完全相同 |
|
fnAddData(mData, bRedraw) → {array} bRedraw是个bool值 |
向表中添加单个新行或多个行数据 |
|
fnAdjustColumnSizing(bRedraw) |
这个函数使DataTabales重新计算列大小 |
|
fnClearTable(bRedraw) |
快速简单的清空table |
|
fnClose(nTr) → {int} |
与“打开”opening"完全相反。这个函数将关闭当前“打开”的任何rovs。 |
|
fnDeleteRow(mTarget, fnCallBack, bRedraw) → {array} |
删除表中一行 |
|
fnDestroy(bRemove) |
完全从DOM中删除表。 |
|
fnDraw(bComplete) |
重绘table |
|
fnFilter(sInput, iColumn, bRegex, bSmart, bShowGlobal, bCaseInsensitive) |
根据数据过滤 |
|
fnGetData(mRow, iCol) → {array|object|string} |
根据提供的参数获取整个表、单个行或单元格的数据。 |
|
fnGetNodes(iRow) → {array|node} |
获取表主体中使用的TR节点的数组。 |
|
fnGetPosition(nNode) → {int} |
Get the array indexes of a particular cell from it's DOM element and column index including hidden columns |
|
fnIsOpen(nTr) → {boolean} |
Check to see if a row is 'open' or not. |
|
fnOpen(nTr, mHtml, sClass) → {node} |
This function will place a new row directly after a row which is currently on display on the page, with the HTML contents that is passed into the function. |
|
fnPageChange(mAction, bRedraw) mAction :string | int Paging action to take: "first", "previous", "next" or "last" or page number to jump to (integer), note that page 0 is the first page. |
Change the pagination - provides the internal logic for pagination in a simple API function |
|
fnSetColumnVis(iCol, bShow, bRedraw) |
Show a particular column |
|
fnSettings() → {object} |
Get the settings for a particular table for external manipulation |
|
fnSort(iCol) |
Sort the table by a particular column |
|
fnSortListener(nNode, iColumn, fnCallback) |
Attach a sort listener to an element for a given column |
|
fnUpdate(mData, mRow, iColumn, bRedraw, bAction) → {int} |
Update a table cell or row - this method will accept either a single value to update the cell with, an array of values with one element for each column or an object in the same format as the original data source. |
|
fnVersionCheck(sVersion) → {boolean} |
Provide a common method for plug-ins to check the version of DataTables being used, in order to ensure compatibility. |
11个事件:
|
destroy |
Destroy event, fired when the DataTable is destroyed by calling fnDestroy or passing the bDestroy:true parameter in the initialisation object. |
|
draw |
Draw event, fired whenever the table is redrawn on the page, at the same point as fnDrawCallback |
|
filter |
Filter event, fired when the filtering applied to the table (using the build in global global filter, or column filters) is altered. |
|
init |
DataTables initialisation complete event, fired when the table is fully drawn, including Ajax data loaded, if Ajax data is required. |
|
page |
Page change event, fired when the paging of the table is altered. |
|
processing |
Processing event, fired when DataTables is doing some kind of processing (be it, sort, filter or anything else). |
|
sort |
Sort event, fired when the sorting applied to the table is altered |
|
stateLoaded |
State loaded event, fired when state has been loaded from stored data and the settings object has been modified by the loaded data. |
|
stateLoadParams |
State load event, fired when the table is loading state from the stored data, but prior to the settings object being modified by the saved state - allowing modification of the saved state is required or loading of state for a plug-in |
|
stateSaveParams |
State save event, fired when the table has changed state a new state save is required. |
|
xhr |
Ajax (XHR) event, fired whenever an Ajax request is completed from a request to made to the server for new data |
接下来在defaults命名空间下包含三个命名空间columns,oLanguage,oSearch,以及58个static properties(静态选项),主要用于初始化 的,给几个重要的看一下。
|
aaData :array |
An array of data to use for the table, passed in at initialisation which will be used in preference to any data which is already in the DOM(就是给一些初始化数据) |
|
aaSorting :array |
You can define which column(s) the sort is performed upon, and the sorting direction, with this variable(初始化时选择排序的对象,如何排序,例如 |
|
aLengthMenu :array |
This parameter allows you to readily specify the entries in the length drop down menu that DataTables shows when pagination is enabled.(就是显示每页多少项,例如 |
|
bJQueryUI :boolean |
Enable jQuery UI ThemeRoller support(但是需要加一些文件,目前正在研究中) |
|
bStateSave :boolean |
Enable or disable state saving. When enabled a cookie will be used to save table display information such as pagination information, display length, filtering and sorting.(这个功能挺有用的) |
|
fnDrawCallback :function |
This function is called on every 'draw' event, and allows you to dynamically modify any aspect you want about the created DOM |
|
fnHeaderCallback :function |
This function is called on every 'draw' event, and allows you to dynamically modify the header row. |
|
fnRowCallback :function |
This function allows you to 'post process' each row after it have been generated for each table draw, but before it is rendered on screen. |
在defaults命名空间下的columns命名空间下又有21个static properties(静态选项),选几个重要的看一下:
|
aDataSort :array |
Allows a column's sorting to take multiple columns into account when doing a sort.(多项配合排序时有用) |
|
asSorting :array |
You can control the default sorting direction, and even alter the behaviour of the sort handler |
|
bSearchable :boolean,bSortable :boolean, bVisible :boolean |
这三个都差不多,看变量名就应该知道它们的意思了。 |
|
mData :string|int|function|null |
This property can be used to read data from any JSON data source property, including deeply nested objects / properties. |
|
mRender :string|int|function|null |
和上面一个差不多,我觉得都是非常重要的函数,如果我要在表格中插入一些标签的,比如input,a,button等,就会用到,而且挺方便的。 |
|
sClass :string,sName :string,sTitle :string,sWidth :string |
基础的东西,sClass为每个td设置一个class,sName:只能在dataTable服务端使用,sTitle就是表格header,swidth:调节每个td宽度 |
在defaults命名空间下的oLanguage,oSearch命名空间下的变量,命名空间就不说了。
在models命名空间下又有5个namespace,分别是ext,oColumn,oRow,oSearch,oSettings。如果有人也在看datatable的doc的话, 我非常希望有人能具体的跟我说说这个models命名空间有什么作用,我只是有一个模糊的概念。
在oApi命名空间下(Reference to internal functions for use by plug-in developers)是为了方便进行二次开发用的,有85个static methods,涵盖了defaults命名空间里所有的函数。
ext命名空间由models命名空间下的ext继承了,所以所有内容都在models/ext下。
看乱了吧,说实话我也乱了,然后我就总结了一些,画了一个思维导图

原创链接: http://www.cnblogs.com/tonylp
dataTables基础函数变量的更多相关文章
- c 变量的存储类型auto等(基础知识)和c函数变量
总结 1).在c语言中每一个变量和函数有两个属性:数据类型和数据的存储类别. 2). 对数据型(如整型.字符型等).存储类别指的是数据在内存中存储的方式. 存储方式分为两大类: 静态存储类和动态存储类 ...
- Python基础3 函数 变量 递归 -DAY3
本节内容 1. 函数基本语法及特性 2. 参数与局部变量 3. 返回值 嵌套函数 4.递归 5.匿名函数 6.函数式编程介绍 7.高阶函数 8.内置函数 温故知新 1. 集合 主要作用: 去重 关系测 ...
- PHP语法(一):基础和变量
相关链接: PHP语法(一):基础和变量 PHP语法(二):数据类型.运算符和函数 PHP语法(三):控制结构(For循环/If/Switch/While) 最近有个H5项目的需求,需要服务端,考察过 ...
- 速战速决 (3) - PHP: 函数基础, 函数参数, 函数返回值, 可变函数, 匿名函数, 闭包函数, 回调函数
[源码下载] 速战速决 (3) - PHP: 函数基础, 函数参数, 函数返回值, 可变函数, 匿名函数, 闭包函数, 回调函数 作者:webabcd 介绍速战速决 之 PHP 函数基础 函数参数 函 ...
- 回归基础: JavaScript 变量提升
from me: javascript的变量声明具有hoisting机制,它是JavaScript一个基础的知识点,也是一个比较容易犯错的点,平时在开发中,大大小小的项目都会遇到. 它是JavaScr ...
- python基础——函数的参数
python基础——函数的参数 定义函数的时候,我们把参数的名字和位置确定下来,函数的接口定义就完成了.对于函数的调用者来说,只需要知道如何传递正确的参数,以及函数将返回什么样的值就够了,函数内部的复 ...
- python基础—函数嵌套与闭包
python基础-函数嵌套与闭包 1.名称空间与作用域 1 名称空间分为: 1 内置名称空间 内置在解释器中的名称 2 全局名称空间 顶头写的名称 3 局部名称空间 2 找一个名称的查找顺序: ...
- python基础—函数装饰器
python基础-函数装饰器 1.什么是装饰器 装饰器本质上是一个python函数,它可以让其他函数在不需要做任何代码变动的前提下增加额外功能. 装饰器的返回值是也是一个函数对象. 装饰器经常用于有切 ...
- Go语言基础之变量和常量
Go语言基础之变量和常量 变量和常量是编程中必不可少的部分,也是很好理解的一部分. 标识符与关键字 标识符 在编程语言中标识符就是程序员定义的具有特殊意义的词,比如变量名.常量名.函数名等等. Go语 ...
随机推荐
- PHPStorm等编辑器debug调试(包括使用postman、soapUI)
很多人在开发的时候,需要进行断点调试,但是很多人配置了很多,还是调试不了,其实是不需要这么麻烦的. 注意:PHPStorm等编辑器debug的配置不用进行任何配置,默认配置就好 实质上,断点调试的时候 ...
- vue的细节
1.如果使用路由跳转到别的界面的话,例如从文章list页面跳转到具体文章查看详情页,查看某一个具体就需要传递那个文章的id去后台查询, this.$router.push的params方法可以实现传递 ...
- python中如何退出多层循环
1.定义标记变量:利用变量值的变化退出循环 # 第一种嵌套形式 a = [[1, 2, 3], [5, 5, 6], [7, 8, 9]] # init_i = 0 # init_j = 0 flag ...
- Python图像处理:图像腐蚀与图像膨胀
图像的膨胀(Dilation)和腐蚀(Erosion)是两种基本的形态学运算,主要用来寻找图像中的极大区域和极小区域.其中膨胀类似于“领域扩张”,将图像中的高亮区域或白色部分进行扩张,其运行结果图比原 ...
- hadoop学习笔记——zookeeper平台搭建
zookeeper是一个自动管理分布式集群的一个工具,以实现集群的高可用. 比如集群中的一个机器挂掉了,没有zookeeper的话就得考虑挂一个机器对剩下集群工作的影响,而有了zookeeper,它就 ...
- HTML基础part1
HTML基础 Web的本质就是利用浏览器访问socket服务端,socket服务端收到请求回复数据提供给浏览器进行渲染显示. import socket def main(): sock = sock ...
- Caliburn.Micro 杰的入门教程3,事件和参数
Caliburn.Micro 杰的入门教程1(翻译)Caliburn.Micro 杰的入门教程2 ,了解Data Binding 和 Events(翻译)Caliburn.Micro 杰的入门教程3, ...
- Prism for WPF 搭建一个简单的模块化开发框架 (一个节点)
原文:Prism for WPF 搭建一个简单的模块化开发框架 (一个节点) 这里我就只贴图不贴代码了,看看这个节点之前的效果 觉得做的好的地方可以范之前的文章看看 有好的建议也可以说说 填充数据 ...
- [BZOJ3563&3569]DZY Loves Chinese
bzoj 加强版 sol 其实前一题还有一种解法的,具体方法请见bzoj讨论版. 以下是正解(?) 建一棵生成树. 考虑什么时候图会不连通:当且仅当存在一条树边被删除,同时所有覆盖了他的非树边也被删除 ...
- 北京Uber优步司机奖励政策(1月30日)
滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...