Seeking expert guidance here! Currently working with Electron and have three key files that are involved in pulling data from a SQLite database (Data.js), organizing this data into arrays, and making it accessible through dropdown lists (Model.js and View.js). The challenge at hand is having the second dropdown list (for province names) filter according to the country selected in the first dropdown. Presently, both countries and provinces' full lists are displayed regardless of the initial selection.
Various attempts have been made, such as implementing an onchange event listener (yet unsuccessful due to certain complexities) or passing back the element value into the SQL query (but facing issues with value retention). Suggestions on the correct method to achieve this would be highly appreciated! Your insights are valuable!
Data.js:
function getCountries(done) {
// Function to pull country details from SQLite
}
function getProvinces(done) {
// Function to retrieve provinces along with their corresponding country details
}
Model.js:
function Countries(done) {
// Access location values from data using specified function
}
function Provinces(done) {
// Retrieve all provinces available
}
View.js:
function viewCountries() {
// Display the list of countries on the page
}
function viewProvinces() {
// Show the provinces based on the selected country
}
HTML:
<p class="col-lg-2 col-md-4 col-sm-8 codes">COUNTRY</p>
// HTML code for displaying country information
<p class="col-lg-2 col-md-4 col-sm-8 codes">PROVINCE</p>
// HTML code for showing province details