Lazy loading totalRowCount
Output buffer only if needed