Skip to content

Commit

Permalink
[#922][3.0] Toolbar 추가 (search 기능)
Browse files Browse the repository at this point in the history
################
- .eslintrc.js : no-param-reassign props 옵션 수정
- setExpandNode() 코드 개선
  • Loading branch information
sh0304 committed Oct 27, 2021
1 parent 2bcab03 commit d1c1ec3
Showing 1 changed file with 8 additions and 23 deletions.
31 changes: 8 additions & 23 deletions src/components/treeGrid/uses.js
Original file line number Diff line number Diff line change
Expand Up @@ -583,19 +583,7 @@ export const treeEvent = (params) => {
const setExpandNode = (children, isShow, isFilter) => {
children.forEach((nodeObj) => {
const node = nodeObj;
if (isFilter) {
if (isShow) {
if (node.isFilter) {
node.show = true;
} else {
node.show = false;
}
} else {
node.show = isShow;
}
} else {
node.show = isShow;
}
node.show = isFilter && isShow ? node.isFilter : isShow;
if (node.hasChild) {
setExpandNode(node.children, node.show && node.expand, node.isFilter);
}
Expand Down Expand Up @@ -629,9 +617,8 @@ export const filterEvent = (params) => {
}
timer = setTimeout(() => {
stores.treeStore.forEach((row) => {
const node = row;
node.show = false;
node.isFilter = false;
row.show = false;
row.isFilter = false;
});
if (searchWord) {
const filterStores = stores.treeStore.filter((row) => {
Expand All @@ -655,16 +642,14 @@ export const filterEvent = (params) => {
return isSameWord;
});
filterStores.forEach((row) => {
const node = row;
node.show = true;
node.isFilter = true;
makeParentShow(node);
row.show = true;
row.isFilter = true;
makeParentShow(row);
});
} else {
stores.treeStore.forEach((row) => {
const node = row;
node.show = true;
node.isFilter = false;
row.show = true;
row.isFilter = false;
});
}
calculatedColumn();
Expand Down

0 comments on commit d1c1ec3

Please sign in to comment.