Skip to content Skip to sidebar Skip to footer

Datatable Get The Values Of All Rows Of A Specific Column

How to get all values of all rows of a specific column? Basically what I want to achieve is, get all the values from 'Key' column and push to allAdminKeys array as global variable

Solution 1:

You can use .columns() function to access the data

let col = 0// can be column index or css class of column header// get all cells of the columnconst cells = $yourDataTable.columns(col).nodes()

Solution 2:

"initComplete": function(settings, json){
                for (var i=0;i<json.keys.length;i++) {                                              
                    allAdminKeys.push(json.keys[i].key);
                }
            }   

Managed to achieve what I wanted by adding this.

Post a Comment for "Datatable Get The Values Of All Rows Of A Specific Column"