Hi,
I am trying to have a page where a user can perform a search via a text input box, and have the results shown via a table on the page.
The search part and result all work well but the issue I have is the table shows ALL data before any search is performed.
How can I have the table be blank until a search is performed?
export function CodeInput2_input(event) {
let code2 = $w('#CodeInput2').value;
wixData.query("PAFKonly")
.eq("customerCode", $w("#CodeInput2").value)
.eq("category",("Pots"))
//used to filter the results by price
.ascending("order")
.find()
.then( (results) => {
$w("#table3").rows = results.items;
} );
}
How are you populating the table when the page is loaded? Is it connected to a dataset? Are you using code?
If you’re using a dataset, disconnect the Table from the dataset. If you’re using code, just don’t run that code.
Hi Yisrael.
Table is connected to a dataset so populates automatically on page load.
If I disconnect it then I lose all my set up columns and formatting.
The only code I have on the page is shown below.
import wixData from "wix-data";
export function CodeInput2_input(event) {
let code2 = $w('#CodeInput2').value;
wixData.query("PAFKonly")
.eq("customerCode", $w("#CodeInput2").value)
.eq("category",("Pots"))
//used to filter the results by price
.ascending("order")
.find()
.then( (results) => {
$w("#table3").rows = results.items;
//$w('#table3').show();
} );
}
Your table shows ALL of the data because it’s connected. Then you are using to populate the table which also causes a conflict with the dataset connection.
Instead, you should disconnect the Table from the dataset and just populate it with code. You can set the columns using code with the .columns property.
Thanks Yisrael. Working now.