In the example below you can see how selecting a value in one drop down (country column) will change the options available in the second column (cities column).
Source Code (Plunker): https://plnkr.co/edit/rmUwBcT0IvfNjHCS
We achieve this using a function for cellEditorParams.
Note we are using a cellEditorSelector to change what type of editor we display in the 'cities' column dynamically.
- if cities map DOES have a values array defined for a country key, then we show a dropdown in the cities column
- if cities map DOES NOT have a values array defined for a country key, then we show an input field.
The following example shows how we can synchronise the values in a drop down based on the value of a cell using a text input:
Source Code (Plunker): https://plnkr.co/edit/QQGn45QjMNeK7YZy?preview
The main difference in the two approaches is that we need to account for the fact that a user might want to tab whilst editing the text cell and have the next cell update. To achieve this, we make use of the valueSetter column property and check whether the city cell needs to be updated, this check happens before the next cell is tabbed to, unlike with onCellValueChanged.
Comments
0 comments
Please sign in to leave a comment.