Fix taxonomy checkfield behavior
This commit is contained in:
parent
67611f7838
commit
eb4830a478
|
|
@ -145,13 +145,22 @@ function handleHierarchicalTaxonomyCheckboxRelation(e) {
|
||||||
if (e.target.checked && e.target.classList.contains('parent-checkbox')) {
|
if (e.target.checked && e.target.classList.contains('parent-checkbox')) {
|
||||||
const parentRootTag = e.target.closest('.checkbox-choice');
|
const parentRootTag = e.target.closest('.checkbox-choice');
|
||||||
const children = parentRootTag.querySelectorAll('.child-checkbox');
|
const children = parentRootTag.querySelectorAll('.child-checkbox');
|
||||||
|
//alert('check parent là');
|
||||||
children.forEach((child) => {
|
/*children.forEach((child) => {
|
||||||
child.checked = true;
|
child.checked = true;
|
||||||
});
|
});*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (e.target.checked && e.target.classList.contains('child-checkbox')) {
|
||||||
|
//alert('check child là');
|
||||||
|
const checkboxRootTag = e.target.closest('.checkbox-choice');
|
||||||
|
const parentCheckbox = checkboxRootTag.parentElement.parentElement.querySelector('.parent-checkbox');
|
||||||
|
|
||||||
|
parentCheckbox.checked = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!e.target.checked && e.target.classList.contains('parent-checkbox')) {
|
if (!e.target.checked && e.target.classList.contains('parent-checkbox')) {
|
||||||
// alert('uncheck parent');
|
//alert('uncheck parent');
|
||||||
const parent = e.target.closest('.checkbox-choice');
|
const parent = e.target.closest('.checkbox-choice');
|
||||||
const children = parent.querySelectorAll('.child-checkbox');
|
const children = parent.querySelectorAll('.child-checkbox');
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user