I need to write a multi column search in a table. Due to some reason (support issue), I am unable to use datatable and table sorter plugin. I need your help in algorithmic part that how can I make multi column search. Please do not give me the link of already created plugins since I have changed table structure too much and I am unable to use those. I need something like this
datatables.net/examples/api/multi_filter.html
if I will get the hint for how its algo works, I will write the same function for me. I have written this code, but it is working on single column search, when I am searching in another column, it resets the search in multi column.
function searchonKeyPress(input_text_box)
{
var query = $.trim(input_text_box.val());
query = query.replace(/ /gi, '|');
if(query=='undefined')
return false;
var index_input = input_text_box.closest("th").index();
index = $("#freeze-tableFreeze .GridviewScrollItem tr:eq("+index_input+") td").length;
$("#freeze-tableFreeze .GridviewScrollItem").each(function() {
var tr_ident = $(this).attr('tr_ident');
var column_text = $(".GridviewScrollItem[tr_ident='"+tr_ident+"'] td:eq("+index_input+")").text();
(column_text.search(new RegExp(query, "i")) < 0) ? $(this).hide().removeClass('visible') : $(this).show().addClass('visible');
});
pagignation(1);
}
I need something like this:
