1.获取表格所有数据
1 | function getTableContent(){ |
2 | var nTrs = table.fnGetNodes(); |
3 | for ( var i = 0; i < nTrs.length; i++){ |
4 | console.log( '[获取数据]' + table.fnGetData(nTrs[i])); |
打印结果:
[获取数据]1,Trident,Internet Explorer 4.0,Win 95+,4,2014/09/01,2014/20/01,X
2.获取表格选中行数据
1 | function getTableContent(){ |
2 | var nTrs = table.fnGetNodes(); |
3 | for ( var i = 0; i < nTrs.length; i++){ |
4 | if ($(nTrs[i]).hasClass( 'selected' )){ |
5 | console.log( '[获取数据]' + table.fnGetData(nTrs[i])); |
3.获取某一行某一列数据
1 | function getTableContent(){ |
2 | var nTrs = table.fnGetNodes(); |
3 | for ( var i = 0; i < nTrs.length; i++){ |
5 | var t = table.fnGetData(nTrs[i]); |
6 | console.log( "aaaaaa:" + t[2]); |