All, I’m following this tutorial to setup a simple page with two dropdown boxes that filter a table.
https://support.wix.com/en/article/corvid-tutorial-adding-collection-data-search-functionality
Either dropdown can be selected to set the rows of a table below the dropdowns. All that is working great. The problem is that one of the dropdowns (providertypedropdown) is filtering a text field (named type) in a collection called Utilities. This field is also a reference field to a collection called UtilityTypes. The type field allows multiple items. So for example a specific utility, Company x, could offer Power utilities and Sewer and Water services.
As I said, the dropdowns work perfectly to filter the table. The issue is that in the table I want to show the Type of utilities they provide (the type field from the Utilities collection in a column of the table. When the field didn’t allow multiple selections it worked fine. Now that I’ve allowed multiple selections on the field, it no longer displays in the table.
In my wixData query, I’ve got a .include(“type”) so that I can get at the UtilityTypes collection. However, I don’t get anything returned when trying to get the Type.title field.
Here is the wixdata query:
wixData.query("Utilities")
.include("type")
.hasSome("type",$w('#providertypedropdown').value)
.ascending("title")
.find()
.then(res => {
$w('#UtilityProviderTable').rows=res.items;
$w('#UtilityProviderTable').expand()
})
And here is where the table is defined:
$w('#UtilityProviderTable').columns = [
{"id" : "logo",
"dataPath" : "logo",
"label" : "Website",
"linkPath" : "website",
"width" : 180,
"type" : "image"
},
{"id" : "Provider",
"dataPath" : "title",
"label" : "Provider",
"width" : 360,
"type" : "string"
},
{"id" : "type",
"dataPath" : "type.title",
"label" : "Type",
"width" : 216,
"type" : "string"
},
{"id" : "Phone",
"dataPath" : "phoneNumber",
"label" : "Phone Number",
"width" : 190,
"type" : "string"
}
]
My question is how to set the right dataPath or what the right method or syntax is for the type (remember this is a text field with multiple select).
Screenshots of each collection is attach.
What am I doing wrong here?
Thanks for any help.
John