jQuery datatables - difference between fnGetNodes() and fnGetData()?

半腔热情 提交于 2019-12-11 03:16:00

问题


I was wondering what the difference is between these two calls? fnGetNodes() returns all rows and so does fnGetData(). What is the difference then?


回答1:


fnGetNodes() returns a list of tr elements that have been generated. If you are using deferRender: true fnGetNodes() will only return rows from pages that have been visited.

fnGetData() on the other hand returns the array of objects aoData that contains all rows of data (but not the tr elements).




回答2:


Interesting.

This is what we should do to access all rows using fnGetNodes()

var rows = $("#myTable").dataTable().fnGetNodes();

Using fnGetData()

$('#table1').dataTable.fnGetData();

I think it's more of functionality where specific and complex row and column operations can be done using fnGetNodes and for more generic operations fnGetData is used.



来源:https://stackoverflow.com/questions/23685522/jquery-datatables-difference-between-fngetnodes-and-fngetdata

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!