How to make a Name Search show on #table2 ? ^-^

This is the code I put, It show on table1 and table2.
So if I want it show on table2 only. What I need to write more?
Thank you for your help.

import wixData from “wix-data”;
let debounceTimer;
export function input1_keyPress(event, $w) {
if (debounceTimer) {
clearTimeout(debounceTimer);
debounceTimer = undefined;
}
debounceTimer = setTimeout(() => {
filter($w(‘#input1’).value);
}, 500);
}

let lastFilterTitle;
function filter(title) {
if (lastFilterTitle !== title) {
$w(‘#dataset1’).setFilter(wixData.filter().contains(‘nameSearch’,title));
lastFilterTitle = title;
}
}

You should modify the IDs and create a KeyPress event for input2. Should the issue persists, please elaborate what you were trying to achieve ( you can do it by adding screenshots as well).

Thanks,
Tal.

Thank you kha. :slight_smile:

The reason you see results on Table1 and Table2 is because you created a filter on yout dataset … most likely you connect both tables to that one dataset. By having 2 datasets you can create a filter to 1 only or instead of a filter code you can write a query and tell the code which table to display query results. Here is another example:

https://www.totallycodable.com/forum/codes-for-templates/search-this-or-that-code-table-results