I want to set up a chain of ASFDS drop downs and I'm not being able to figure out how to wire it up, all together.
My model on the $scope
is called item
. I've got an ASF form with ASFDS drop downs, the idea is that we will have chaining drop downs - when one is selected the next one will filter to match.
Take for example, this schema
{
type: "object",
properties: {
ID: {type: "integer", readOnly: true, description: "Internal ID, display-only"},
Name: {type: "string", minLength: 2, title: "Name", description: "Name or alias"},
CityID: {type: "integer", title: 'City', description: "Postal Code belongs to this state"},
StateID: {type: "integer", title: 'State', description: "City belongs to this state"},
CountryID: {type: "integer", title: 'Country', description: "State belongs to this country"},
}
}
and this form:
form: [
'ID',
'Name',
{
'key': 'CountryID',
'type': 'strapselect',
'placeholder': 'Select country',
'options': {
'asyncCallback': 'promiseMasterDataForEntity',
'entity': 'Country',
'fields': ['ID', 'Name'],
"map": {valueProperty: "ID", nameProperty: "Name"}
}
},
{
'key': 'StateID',
'type': 'strapselect',
'placeholder': 'Select state',
'options': {
'asyncCallback': 'promiseMasterDataForEntity',
'entity': 'State',
'fields': ['ID', 'Name', 'CountryID'],
"map": {valueProperty: "ID", nameProperty: "Name"}
}
},
{
'key': 'CityID',
'type': 'strapselect',
'placeholder': 'Select city',
'options': {
'asyncCallback': 'promiseMasterDataForEntity',
'entity': 'City',
'fields': ['ID', 'Name', 'StateID'],
"map": {valueProperty: "ID", nameProperty: "Name"}
}
},
{
name: 'SAVE', control: {
type: "submit",
title: "Save"
}
]
When the user changes country
, state
should be filtered. When the user changes state
, city
should be filtered.
I've got all three ASFDSs showing all values, with asyncCallback fetches, all that works well. Problem is, how to do a change cascade filter?
I tried using the filter clauses, but could not get it to work. If you could provide more examples, of how to do this, or more details on the filter clauses, I would really appreciate it and make it work.
Thanks!