Hello,
Do you have any ideas on how to remove the additional option in the dropdown menu which contains nothing?
See the picture below
Thanks
Hello,
Do you have any ideas on how to remove the additional option in the dropdown menu which contains nothing?
See the picture below
Thanks
If you use code to assign the options to the dropdown, please post it here.
Thanks for your response.
No I am not using code to assign the options.
I use a dataset to connect to members database. So the option contained is from database, but cannot figure how the other empty option choice appears there. Dataset has a filter for owner.
@duriosippos Check that you don’t have blank lines or fields in your database collection.
@yisrael-wix Thanks for your reply. The only fields are that are empty in the database were the titles. I have filled them to check but the issue persists.
I guess the issue lays on the fact that I am using the dropdown to filter a table.
Perhaps if I use code to define the dropdown options the issue won’t occur? If that is the case can someone assist with the code. Your help is much appreciated.
I have used the following code:
import wixData from "wix-data";
export function dropdown1_change_1(event) {
wixData.query("Repay")
// Query the collection for any items whose "Name" field contains
// the value the user entered in the input element
.contains("accountNumber", $w("#dropdown1").value)
.find() // Run the query
.then(res => {
// Set the table data to be the results of the query
$w("#table2").rows = res.items;
});
}
$w.onReady(function () {
$w("#table2").columns = [
{
"id": "col1", // ID of the column for code purposes
// The field key in the collection whose data this column displays
"dataPath": "accountNumber",
"label": "Account Number", // The column header
"width": 100, // Column width
"type": "string", // Data type for the column
// Path for the column if it contains a link
},
{
"id": "col2",
"dataPath": "date",
"label": "Date",
"visible": true,
"type": "date",
},
{
"id": "col3",
"dataPath": "trade",
"label": "Trade",
"visible": true,
"type": "string",
},
{
"id": "col4",
"dataPath": "tradeSize",
"label": "Trade Size",
"visible": true,
"type": "string",
},
{
"id": "col5",
"dataPath": "repayusd",
"label": "Repay",
"visible": true,
"type": "string",
} //,
// more column objects here if necessary
// ...
// ...
];
});
Consider this resolve. I have set a filter condition on dataset to IS not empty. Thanks a lot folks.
Well done for solving it for yourself.
Although you should really have your onReady page function underneath your imports line otherwise your dropdown onChange event is happening before the page is loaded and ready.
import wixData from "wix-data";
$w.onReady(function () {
});
export function dropdown1_change_1(event) {
wixData.query("Repay")
Just note that there are examples that you can use if you needed them.
Writing labels and values yourself through code.
Dropdown from Dataset.
https://www.vorbly.com/Vorbly-Code/WIX-CODE-DROPDOWN-OPTIONS-FROM-DATABASE
Also, search the forum for previous posts as you will find many of them.
Thank you very much for your time and advise. Much appreciated.