Hi yisrael,
The filtering was working for 1 day and it stop after i change the database with the same field key. i check my code and there was no errors and was left scratching my head where went wrong
import wixData from ‘wix-data’;
$w.onReady(function(uniquemake) {
wixData.query(“fbbk”)
.ascending(‘make’)
.limit(1000)
.find()
.then(results => {
const uniquemakes = getUniquemakes(results.items);
$w(“#make”).options = buildOptions(uniquemakes);
});
function getUniquemakes(items) {
const makesOnly = items.map(item => item.make);
return […new Set(makesOnly)];
}
function buildOptions(uniqueList) {
return uniqueList.map(curr => {
return {label:curr, value:curr};
});
}
});
$w.onReady(function (column) {
$w(“#table1”).columns = [
{
“id”: “make”, // ID of the column for code purposes
“dataPath”: “make”,
“label”: “MAKE”, // The column header
“width”: 80, // Column width
“visible”: true, // Column visibility
“type”: “string”, // Data type for the column
“linkPath”: “link-field-or-property”
},
{
“id”: “type”,
“dataPath”: “type”,
“label”: “TYPE”,
“width”: 80,
“visible”: true,
“type”: “string”,
“linkPath”: “link-field-or-property”
},
{
“id”: “model”,
“dataPath”: “model”,
“label”: “MODEL”,
“width”: 200,
“visible”: true,
“type”: “string”,
“linkPath”: “link-field-or-property”
},
{
“id”: “chassis”,
“dataPath”: “chassis”,
“label”: “CHASSIS”,
“width”: 80,
“visible”: true,
“type”: “string”,
“linkPath”: “link-field-or-property”
},
{
“id”: “year”,
“dataPath”: “year”,
“label”: “YEAR”,
“width”: 80,
“visible”: true,
“type”: “string”,
“linkPath”: “link-field-or-property”
},
{
“id”: “partNo”,
“dataPath”: “partNo”,
“label”: “PART NO.”,
“width”: 80,
“visible”: true,
“type”: “string”,
“linkPath”: “link-field-or-property”
},
{
“id”: “reqNoOfFrontHoseStainless”,
“dataPath”: “reqNoOfFrontHoseStainless”,
“label”: “REQ NO. OF FRONT HOSE(STAINLESS).”,
“width”: 200,
“visible”: true,
“type”: “string”,
“linkPath”: “link-field-or-property”
},
{
“id”: “reqNoOfRearHoseStainless”,
“dataPath”: “reqNoOfRearHoseStainless”,
“label”: “REQ NO. OF REAR HOSE(STAINLESS).”,
“width”: 200,
“visible”: true,
“type”: “string”,
“linkPath”: “link-field-or-property”
},
{
“id”: “kw”,
“dataPath”: “kw”,
“label”: “KW”,
“width”: 50,
“visible”: true,
“type”: “string”,
“linkPath”: “link-field-or-property”
},
{
“id”: “pcd”,
“dataPath”: “pcd”,
“label”: “PCD”,
“width”: 50,
“visible”: true,
“type”: “string”,
“linkPath”: “link-field-or-property”
}
];
});
export function make_change(event, $w) {
wixData.query(‘fbbk’)
.contains(‘make’, $w(‘#make’).value)
.find()
.then(res => {
$w(‘#table1’).rows = res.items;
});
}
export function model_change(event, $w) {
wixData.query(‘fbbk’)
.contains(‘make’, $w(‘#make’).value)
.contains(‘model’, $w(‘#model’).value)
.find()
.then(res => {
$w(‘#table1’).rows = res.items;
});
}
this is my site, https://cjdynamics2012.wixsite.com/cjdynamics-copy/database-selection
even removing of duplicate item function doesn’t work