Hi, I am using a viewmodel in my custom grid(using knockout custom template).There is a list of all alphabets in below that grid for filtering. Filtering means when i click on ‘A’ the data start with alphabet ‘A’ should be visible only. When i click ‘B’ the data start with ‘B’ should be visible only in custom grid. The code is working fine for current visible data in grid but it is not filtering whole viewmodel data. I know there is some problem in my jquery selector –$(".row") but i dont know how to resolve it. Here is my code :
abcFilter: function (filterChar) {
if (filterChar !== 'All') {
$(".row").filter(function () {
return $(this).children('td').eq(1).text().substring(0, 1).toLowerCase() != filterChar.toLowerCase();
}).hide();
}
else {
$("table tr").show();
}
};`
I use this binding for grids, its very powerful (It utilizes the datatables.net grid)
https://github.com/CogShift/Knockout.Extensions
edit: This just got accepted as answer, as we speak there is a better alternative out in the form pf a native KO grid.
https://github.com/Knockout-Contrib/KoGrid