mirror of
https://github.com/hargata/lubelog.git
synced 2025-12-10 00:46:08 -06:00
column specific search
This commit is contained in:
parent
d0f80d4150
commit
04a103fdc0
@ -909,6 +909,15 @@ function searchTableRows(tabName) {
|
||||
if (result.isConfirmed) {
|
||||
var rowData = $(`#${tabName} table tbody tr`);
|
||||
var filteredRows = $(`#${tabName} table tbody tr td:contains('${result.value.searchString}')`).parent();
|
||||
if (result.value.searchString.includes('=') && result.value.searchString.split('=').length == 2) {
|
||||
//column specific search.
|
||||
//get column index
|
||||
var columns = $(`#${tabName} table th`).toArray().map(x => x.innerText);
|
||||
var columnName = result.value.searchString.split('=')[0];
|
||||
var colSearchString = result.value.searchString.split('=')[1];
|
||||
var colIndex = columns.findIndex(x => x == columnName) + 1;
|
||||
filteredRows = $(`#${tabName} table tbody tr td:nth-child(${colIndex}):contains('${colSearchString}')`).parent();
|
||||
}
|
||||
if (result.value.searchString.trim() == '') {
|
||||
rowData.removeClass('override-hide');
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user