JQuery DataTable 1.10.2 使用笔记_JAVA_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > JAVA > JQuery DataTable 1.10.2 使用笔记

JQuery DataTable 1.10.2 使用笔记

 2014/10/9 0:17:36  zwr_skyon  程序员俱乐部  我要评论(0)
  • 摘要:一、定义(options):column列定义:"columns":[{"data":"platform","render":"[,].name""defaultContent":"<button>edit</button>","cellType":"th”,}{......},{......}]1.data:是数据get/set的方式。可以自己定义。有很多种方式2.render:也类似,但是他只是改变数据的变现方式。即只改变get。3.defaultContent
  • 标签:笔记 使用 jQuery
一、定义(options):

column 列定义:

class="java">		"columns": [
	    {
	      "data": "platform",
	      "render": "[, ].name"
	      "defaultContent":"<button>edit</button>",
	      "cellType": "th”,
	    }
	    {......},{......}
	  ]

  • 1.data:   是数据get/set的方式。可以自己定义。有很多种方式
  • 2.render: 也类似,但是他只是改变数据的变现方式。即只改变get。
  • 3.defaultContent:如果返回的数据中没有对应的列,使用的默认值

  • 如果只是想改变表格数据的展现方式而不改变底层的数据,建议用render
      引用关于3个值的匹配顺序:
      返回值是undefined the columns.defaultContentDT value will be used. If there is no default content specified, an error will be given.返回值是null If columms.renderDT is used, the data passed to the rendering function will be the original data source for the row. If there is no renderer the columns.defaultContentDT value will be used. If there is no default content specified, for display data an empty sting will be used. -type null will be used for all other data types.返回值是一个functionthe function will be executed and the returned value used. As of DataTables 1.10.1 the function will be executed in the same scope as the data object for the row. The result of this is that an object instance can be used as the data source for a row.
  • 4.cellType:指定这一组定义适用的类型 TD TH 用<td>还是<th>包裹

columnDefs:
类似于column 但是多了一个targets属性。可以指定应用到那些列。
          targets:参数正数从左往右的列index负数从右往左string定义好的列名
                   
                   
二、API
DT使用中有两个根级别的对象。DataTables.Api 和 JQuery。DT的API大部分会要有API这个对象。
   

    使用构造器
   
$( selector ).DataTable(); 返回一个API对象 
$( selector ).dataTable();  返回一个JQ对象
new $.fn.dataTable.Api( selector ); 直接构造一个DT,并返回API对象。


API<==>JQ
JQ对象=api对象.to$();
api对象=JQ对象.api();



特有的选择器类(types):

cell-selector:当做选择器,在API.cells(cell-selector)这样的函数中的参数。
以下这几种可以充当他的值
stringJQ中的选择器nodedom中的th,tdJQuery用JQuery对象表示的cell元素objectDT中的cell index值(通过row或者column方法点出来的)array如[ , ]元素可以包含上面的所有类型

columns-selector:当做选择器,在API.columns()、cells()这样的函数中的参数。
一下这几种可以充当他的值
integercolumn中的index{integer}:visIdxcolumn显示的列(不包括隐藏的)的index{integer}:visiblecolumn显示的列(不包括隐藏的)的index{string}:name用columns.name定义好列的内部名字,这里用名字调用stringJQ中的选择器nodedom中的th,tdJQuery用JQuery对象表示的cell元素array如[ , ]元素可以包含上面的所有类型

row-selector:当做选择器,在API.row or cells(cell-selector)这样的函数中的参数。
以下这几种可以充当他的值
integer行数stringJQ中的选择器nodedom中的th,tdJQuery用JQuery对象表示的cell元素array如[ , ]元素可以包含上面的所有类型

table-selector:当做选择器,在API.table()这样的函数中的参数。
以下这几种可以充当他的值
integer第几个tablestringJQ中的选择器nodedom中的th,tdJQuery用JQuery对象表示的cell元素array如[ , ]元素可以包含上面的所有类型

selector-modifier:用在rows(), columns() and cells()的参数中。
过滤、排序、分页的相关属性的选择器
他只会针对当前页面中的元素进行过滤。因此,如果用在服务器操作数据的模式上,他作用很小。
包含的属性:
{
    order:  'current', //选择的数据的显示顺序  'current', 'applied', 'index',  'original'
    search: 'none',    // 'none',    'applied', 'removed'
    page:   'all'      // 'all',     'current'
}




上一篇: java基础:类的继承 下一篇: java 运行参数
发表评论
用户名: 匿名