Loop through DataTables table to get all cells content

后端 未结 4 1531
北恋
北恋 2021-02-04 01:21

I am using jquery dataTables to generate the paginated table on my site. I need to run a process that grabs all of the data out of a particular column. Something like :

<
4条回答
  •  抹茶落季
    2021-02-04 01:47

    jQuery.map combined with fnGetData() makes for a compact solution. The following function will return a one-dimensional array containing all the values from obj_dtable's nth column:

    function getDataTableColumn(obj_dtable,n) {
        return $.map(obj_dtable.fnGetData(), function(val) {
            return val[n];
        });
    };
    

提交回复
热议问题