I am having trouble getting the correct totalRecords value from my collection when performing a search with Backgrid's Client-Side filter extension.
Specifically, when I use the backspace key on my keyboard.
If I do not use the backspace, and type slowly, this seems to work fine:
//Search input field - keyup event
$("input[name='q']").keyup(function () {
console.log('searchcontainer input - keyup event');
console.log($(this).val())
console.log($(this).val().length)
var key = event.keyCode || event.charCode;
if (key == 8) { //'8' == backspace key
console.log('backspace was keyed!')
//how do I refresh the 'totalRecords' property on the collection?
}
console.log((_myCollection.state.totalRecords || "0") + " records found."));
$("#lblRecordsFound").text((_myCollection.state.totalRecords || "0") + " records found.");
});
It seems like the totalRows skips a collection update(?) when a backspace is fired?
How can I get the current totalRows, when using backspace? Do I need to reset, fetch or refresh the collection? I am unsure. Help?
I simply need the totalRows that are currently displayed in the grid, at any moment.