System Dictionaries shall allow to search by the values - scrolling to the bottom of the items list when clicking 'Add value'
@@ -252,7 +252,14 @@ class SystemDictionaryForm extends React.Component {
items.push({value: '', autofill: true, links: [], filtered: true});
this.setState({
items: items.slice()
- }, this.afterChange);
+ }, () => {
+ setTimeout(() => {
+ if (this.itemsPanel) {
+ this.itemsPanel.scrollTop = this.itemsPanel.scrollHeight;
+ }
+ });
+ this.afterChange();
+ });
};
onChangeLinks = (links) => {
@@ -283,6 +290,10 @@ class SystemDictionaryForm extends React.Component {
}
};
+ onItemsPanelInitialized = (ref) => {
+ this.itemsPanel = ref;
+ }
+
render () {
const {disabled, isNew} = this.props;
const {linksFormVisible, editableLinksIndex} = this.state;
@@ -322,7 +333,10 @@ class SystemDictionaryForm extends React.Component {
</div>
)
}
- <div className={styles.items}>
+ <div
+ ref={this.onItemsPanelInitialized}
+ className={styles.items}
+ >
{
items.map((item, index) => (
<div
