Count rows where a column is greater than zero

Count rows where a column is greater than zero

TronikTronik Posts: 120Questions: 27Answers: 1

Hi!

Currently using

var rowCount = api.column(0).data().length;

Im wondering how I can count the rows which have a value in a column that is greater than zero?

Answers

  • kthorngrenkthorngren Posts: 20,322Questions: 26Answers: 4,774

    You can try filter then get the length of the returned array.

    Kevin

  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin

    Use count() rather than .length to get the number of elements in a DataTables API instance. .length will work sometimes, but at other times it won't since a 2D structure can be used to represent different tables.

    Allan

This discussion has been closed.