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: 9,856Questions: 0Answers: 1,635

    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: 1,770Questions: 51Answers: 260

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

Sign In or Register to comment.