I am currently building a form and one of the user input drop down is not showing all the data from the dataset (ie regions. only 5 out of 10 are showing). I presumed that maybe there were some issues with the CSV file used to populate the dataset, but after making sure that all is as it should be it is still not working as it should (i tried using a CSV file, MS DOS CSV file, a MAC CSV file but the same problem occurs). Anyone has any idea what could be the issue here?
Below is the code for the page:
import wixData from ‘wix-data’;
$w.onReady( function () {
populateRegion();
populateCommune();
});
function populateRegion(){
wixData.query(“Region2”)
.find()
.then(results => {
var uniqueList = createUniqueList(results.items);
$w(“#iptRegion”).options = buildOptions(uniqueList);
})
function createUniqueList(items){
var titlesOnly = items.map(item => item.region);
titlesOnly.sort();
return [… new Set(titlesOnly)];
}
function buildOptions (uniqueList){
var uniqueListFinal = uniqueList.map(curr => { return {label :curr, value:curr}; });
return uniqueListFinal;
}
}
function populateCommune(){
wixData.query(“Region2”)
.eq(‘region’,$w(“#iptRegion”).value)
.find()
.then(results => {
var uniqueList = createUniqueList(results.items);
$w(“#IptCommune”).options = buildOptions(uniqueList);
})
function createUniqueList(items){
var titlesOnly = items.map(item => item.commune);
titlesOnly.sort();
return [… new Set(titlesOnly)];
}
function buildOptions (uniqueList){
var uniqueListFinal = uniqueList.map(curr => { return {label :curr, value:curr}; });
return uniqueListFinal;
}
}
export function iptRegion_change(event) {
populateCommune();
$w(“#IptCommune”).enable();
}
Here is what the dropdown shows.
Here’s the CSV file used to populate the dataset