Have Column API only return specific rows

Have Column API only return specific rows

rite_ehrite_eh Posts: 3Questions: 1Answers: 0

Hello,

I am populating a DataTable from a standard HTML table. I'm not allowing sorting for this particular table. My table consists of regular cells and also subtotal lines interspersed in the DT. The subtotal lines have a different color background (#CCCCCC).

Is there a way I can continue to populate the TataTable as I am now, but have the column/columns API calls return the requested data, excluding the subtotal lines based on their background color?

I'm assuming this will require modifying the API calls in the DT js file, just trying to figure out which method will require said modification... Any assistance is greatly appreciated!

Replies

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin

    What I would suggest is to use the cells() API with a combination of a row and column selector. For example:

    table.cells( ':not(.subtotal)', 4 ).nodes()
    

    will get the nodes for the intersection of the cells in column 4 and rows which do not have a class of .subtotal on the tr element (you might need to add that).

    The cells() method can often be used in place of the rows() or columns() method in this fashion.

    Allan

  • rite_ehrite_eh Posts: 3Questions: 1Answers: 0

    Thanks for your help Allan!

This discussion has been closed.