Retrieving row data after filtering JQuery Datatables

后端 未结 8 443
广开言路
广开言路 2020-12-28 18:09

Seems like it should be easy but...

Does anyone know how to return the current rows from a filtered dataTable? The oTable.fnGetNodes() method returns

8条回答
  •  孤独总比滥情好
    2020-12-28 18:41

    Better late than never but I was struggling with this myself. Here's what I came up with

    $.fn.dataTableExt.oApi.fnGetVisibleData = function(){
        displayed = [];
        currentlyDisplayed = this.fnSettings().aiDisplay; //gets displayed rows by their int identifier
        for (index in currentlyDisplayed){
            displayed.push( this.fnGetData( currentlyDisplayed[index] ));
        }
        return displayed;
    
    }
    

提交回复
热议问题