we have to add 

var itemsCount = this.__getTotalItemCount();