we have used ng2-smart-table for our project and I have a request now where one of the select input list is dependent upon selection of another list. For instance, in the below example there are 2 Inputs (Country & Cities) and when User selects one of the Countries from drop down then the cities would get populated. So, whenever the user selects a different country then the Cities list would get populated with appropriates cities:
Could someone please let me know if this is possible in ng2-smart-table?
My current settings
mode: internal,
country: {
title: 'Country',
type: 'html',
valuePrepareFunction: (cell, row) => { return cell },
editor: {
type: 'list',
config:
{ list: []
},
}
},
city: {
title: 'City',
type: 'html',
editor:
{
type: 'list',
config:
{ selectText: 'Select the Location to see options...',
list: []
},
}
}
This is how the list is getting populated:
let countryAll = this.countryService.getAll();
let cityAll =this.cityService.getAll();
const countryOptions = [];
for (const l of this.countryAll) {
locationOptions.push({ value: l.name, title: l.name });
}
this.settings.columns.country.editor.config.list = countryOptions;
const cityOptions = [];
for (const l of this.cityAll) {
locationOptions.push({ value: l.name, title: l.name });
}
this.settings.columns.city.editor.config.list = cityOptions;