Count rows where a column is greater than zero

Count rows where a column is greater than zero

TronikTronik Posts: 122Questions: 28Answers: 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: 21,459Questions: 26Answers: 4,975

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

    Kevin

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 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.