fix issue with inserting/editing boolean fields (close #2536, #2798)

This commit is contained in:
Rikin Kachhia 2019-08-29 15:34:27 +05:30 committed by GitHub
commit 7f818b8b19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 9 deletions

View File

@ -82,7 +82,9 @@ class EditItem extends Component {
refs[colName].valueNode = node; refs[colName].valueNode = node;
}; };
const clicker = e => { const clicker = e => {
e.target.closest('.radio-inline').click(); e.target
.closest('.radio-inline')
.querySelector('input[type="radio"]').checked = true;
e.target.focus(); e.target.focus();
}; };

View File

@ -9,8 +9,6 @@ import TextInput from '../../../Common/CustomInputTypes/TextInput';
import Button from '../../../Common/Button/Button'; import Button from '../../../Common/Button/Button';
import { getPlaceholder, BOOLEAN, JSONB, JSONDTYPE, TEXT } from '../utils'; import { getPlaceholder, BOOLEAN, JSONB, JSONDTYPE, TEXT } from '../utils';
import { getParentNodeByClass } from '../../../../utils/domFunctions';
import { NotFoundError } from '../../../Error/PageNotFound'; import { NotFoundError } from '../../../Error/PageNotFound';
class InsertItem extends Component { class InsertItem extends Component {
@ -81,12 +79,9 @@ class InsertItem extends Component {
refs[colName] = { valueNode: null, nullNode: null, defaultNode: null }; refs[colName] = { valueNode: null, nullNode: null, defaultNode: null };
const inputRef = node => (refs[colName].valueNode = node); const inputRef = node => (refs[colName].valueNode = node);
const clicker = e => { const clicker = e => {
const checkboxLabel = getParentNodeByClass(e.target, 'radio-inline'); e.target
if (checkboxLabel) { .closest('.radio-inline')
checkboxLabel.click(); .querySelector('input[type="radio"]').checked = true;
} else {
e.target.parentNode.click();
}
e.target.focus(); e.target.focus();
}; };