Hi,
I am trying to implement a search functionality to my website using this article:
https://support.wix.com/en/article/corvid-tutorial-adding-collection-data-search-functionality
My problem is that it doesn't search and I suppose it's due to those two error messages in editor.
"rows" does not exist on #cert. on line 12 "columns" does not exist on #cert on line 18
and I couldn't figure out what went wrong. I need your help with this.
Thanks,
Any help is highly appreciated!
CODE:
import wixData from "wix-data";
export function searchIcon_click(event) {
// Runs a query on the "recipes" collection
wixData.query("VerilenSertifikalar")
// Query the collection for any items whose "Name" field contains
// the value the user entered in the input element
.contains("SertifikaNumarasi", $w("#SearchBox").value)
.find() // Run the query
.then(res => {
// Set the table data to be the results of the query
$w("#cert").rows = res.items; }); // IT GIVES ERROR: "rows" does not exist on #cert.
}
$w.onReady(function () {
$w("#cert").columns = [ // IT GIVES ERROR: "columns" does not exist on #cert.
{
"id": "col1", // ID of the column for code purposes
// The field key in the collection whose data this column displays
"dataPath": "SertifikaNumarasi",
"label": "Sertifika Numarası", // The column header
"width": 100, // Column width
"type": "string", // Data type for the column
// Path for the column if it contains a link
"linkPath": "link-field-or-property"
},
{
"id": "col2",
"dataPath": "VerilenSertifikaAdi",
"label": "Verilen Sertifika Adı",
"visible": true,
"type": "string",
"linkPath": "link-field-or-property"
} ,
{
"id": "col3", // ID of the column for code purposes
// The field key in the collection whose data this column displays
"dataPath": "firmaAdi",
"label": "Firma Adı", // The column header
"width": 200, // Column width
"type": "string", // Data type for the column
// Path for the column if it contains a link
"linkPath": "link-field-or-property"
},
{
"id": "col4", // ID of the column for code purposes
// The field key in the collection whose data this column displays
"dataPath": "SertifikaKapsami",
"label": "Sertifika Kapsamı", // The column header
"width": 200, // Column width
"type": "string", // Data type for the column
// Path for the column if it contains a link
"linkPath": "link-field-or-property"
},
];
});
It worked, thanks. I appreciate your help.
Post if this works !!
Thanks Ajit for your answer but I added the table using table master and changed the ref. to that table and I still get "rows" doesn't exist on "table"
Just change the $w("#cert").columns and $w("#cert").rows
to your table
like $w('#table1').rows
and
$w('#table1').columns