I have been working on a catalog for auto parts for the past while. After spending weeks scraping and formatting my database to be usable, I was extremely disappointed to find out about the limit of 1,000 lines for my drop-down search.
In short, I have a lot more than 1,000 lines of data in my database, and I need the drop-drown to search through all of it, and display the resulting data in a table.
My website is www.raiken.ca and this function is on my home page.
If I try to increase the limit in my code, the drop-downs will not work.
Unless there’s something wrong with my code, the limit of 1,000 lines will be the reason for me to say goodbye to WIX and find an alternative.
Below is all of my code.
import wixData from “wix-data”;
$w.onReady( function () {
yearDropdownDefault();
});
function yearDropdownDefault() {
wixData.query(“V20181204_556_EB”)
.limit(1000)
.find()
.then(results => {
const uniqueTitles = getUniqueTitles(results.items);
$w(“#yearDropdown”).options = buildOptions(uniqueTitles);
});
function getUniqueTitles(items) {
const titlesOnly = items.map(item => item.year);
return [… new Set(titlesOnly)];
}
function buildOptions(uniqueList) {
uniqueList.sort();
uniqueList.reverse();
return uniqueList.map(curr => {
return {label: curr, value: curr};
});
}
}
export function yearDropdown_change(event, $w) {
if ( $w(“#makeDropdown”).enabled ) {
$w(“#makeDropdown”).disable();
$w(“#modelDropdown”).disable();
$w(“#makeDropdown”).selectedIndex = undefined;
$w(“#modelDropdown”).selectedIndex = undefined;
uniqueDropDown2();
uniqueDropDown3();
$w(“#makeDropdown”).enable();
}
else {
uniqueDropDown2();
uniqueDropDown3();
$w(“#makeDropdown”).enable();
}
}
function uniqueDropDown2() {
wixData.query(“V20181204_556_EB”)
.contains(“year”, $w(“#yearDropdown”).value)
.limit(1000)
.find()
.then(results => {
const uniqueTitles = getUniqueTitles(results.items);
$w(“#makeDropdown”).options = buildOptions(uniqueTitles);
});
function getUniqueTitles(items) {
const titlesOnly = items.map(item => item.make);
return [… new Set(titlesOnly)];
}
function buildOptions(uniqueList) {
uniqueList.sort();
return uniqueList.map(curr => {
return {
label: curr,
value: curr
};
});
}
}
export function makeDropdown_change(event, $w) {
if ( $w(“#modelDropdown”).enabled ) {
$w(“#modelDropdown”).disable();
$w(“#modelDropdown”).selectedIndex = undefined;
yearDropdownDefault();
uniqueDropDown3();
$w(“#modelDropdown”).enable();
}
else {
yearDropdownDefault();
uniqueDropDown3();
$w(“#modelDropdown”).enable();
}
}
function uniqueDropDown3() {
wixData.query(“V20181204_556_EB”)
.contains(“make”, $w(“#makeDropdown”).value)
.contains(“year”, $w(“#yearDropdown”).value)
.limit(1000)
.find()
.then(results => {
const uniqueTitles = getUniqueTitles(results.items);
$w(“#modelDropdown”).options = buildOptions(uniqueTitles);
});
function getUniqueTitles(items) {
const titlesOnly = items.map(item => item.model);
return [… new Set(titlesOnly)];
}
function buildOptions(uniqueList) {
uniqueList.sort();
return uniqueList.map(curr => {
return {
label: curr,
value: curr
};
});
}
}
export function modelDropdown_change(event, $w) {
$w(“#appSearch”).enable();
}
export function appSearch_click(event, $w) {
if ( $w(“#table1”).collapsed ) {
$w(“#table1”).expand();
}
else {
}
ProdResult();
}
function ProdResult() {
$w(‘#dataset1’).setFilter(wixData.filter()
.eq(‘year’, $w(“#yearDropdown”).value)
.eq(‘make’, $w(“#makeDropdown”).value)
.eq(‘model’,$w(“#modelDropdown”).value)
);
$w(‘#dataset1’).refresh()
}
If there is a fix to this, please let me know.