count number of rows that contain a specific string in a certain column

count number of rows that contain a specific string in a certain column

magmomagmo Posts: 6Questions: 3Answers: 0

Hi

Is it possible to count all rows in a datatable that contains a specific string in a certain column? I guess this has to be done in table.on( 'draw' since I want it to work when using filtering also. Hope someone can help me out here.

Answers

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    Yep, draw is one way to go. Possibly better to do it in search, as draw would also be called when ordering and paging, which wouldn't affect the count, but that would only really matter if you're expecting a large number of records,

    Colin

  • rf1234rf1234 Posts: 2,801Questions: 85Answers: 406

    Use table.rows().count() with search: “applied“ like table.rows( {search: “applied“}).count()

This discussion has been closed.