반응형
아래 함수를 useEffect(,[])에서 못 부름
위치가 문제인가?
setListData
const setListData = () => {
setCurrent(true);
noticeSeq.current = null;
const query = new Query();
let queryId = '';
if (currentTab === 1) {
queryId = '/cmmNotice/selectFarmFaqList';
}
if (currentTab === 0) {
queryId = '/cmmNotice/selectNoticeList';
}
if (currentTab === 1) {
let checkCategory = [];
let checkboxList, allCheckbox;
allCheckbox = document.querySelector('#checkallFaqType');
checkboxList = document.querySelectorAll('._checkboxFaqType');
if (allCheckbox.checked) {
for (let i = 0; i < checkboxList.length; i++) {
checkCategory.push((checkboxList.item(i)).value)
};
} else {
for (let i = 0; i < checkboxList.length; i++) {
if ((checkboxList.item(i)).checked === true) {
checkCategory.push((checkboxList.item(i)).value)
}
};
}
if (checkCategory.length > 0) {
query.addParams('cond_check_faq_type', checkCategory);
}
srchParamKeyword.current = txtSrchFaq.current.value;
srchParamCond.current = cmbOptCondFaq.current.value;
}
if (currentTab === 0) {
query.addParams('cond_st_dt', getFromDateStr(new Date()));
query.addParams('cond_ed_dt', getFromDateStr(new Date()));
srchParamKeyword.current = txtSrchNotice.current.value;
srchParamCond.current = cmbOptCondNotice.current.value;
}
if (srchParamKeyword.current !== '') {
if (srchParamCond.current === initialData.dsSearchTypeList[1].VALUE) {
query.addParams('cond_title', srchParamKeyword.current);
} else if (srchParamCond.current === initialData.dsSearchTypeList[2].VALUE) {
query.addParams('cond_content', srchParamKeyword.current);
} else if (srchParamCond.current === initialData.dsSearchTypeList[0].VALUE) {
query.addParams('cond_title_content', srchParamKeyword.current);
}
}
query.addParams('cond_use_yn', 'Y');
const dataManager = one.createDataManger(
{
service: 'farmos',
queryId: queryId
}
);
dataManager.executeQuery(
query,
(res) => {
if (currentTab === 1) {
}
if (currentTab === 0) {
}
boardList.current.setBoardList(res.result);
},
(error) => {
const message = one.resMsg(error);
one.alertMsg('', message);
}
)
}
반응형
'react' 카테고리의 다른 글
Promise결과를 받아서 useMemo에 저장후 사용하려 하면 에러남, useState로 저장후에 useEffect로 감지하려고 해도 에러남 (0) | 2024.04.08 |
---|---|
[페이지전환]react-router-dom<Link> window.href.location history.push()... (0) | 2024.03.27 |
useRef - 여러개일때 배열로 사용하는 방법 (1) | 2024.02.20 |
[React Jsx Syntax] style="display:none;"에러남 style={{display:'none',...}}로 써야함 (0) | 2024.01.22 |
react에 css 파일 import할때 css파일내에 문법에러있으면 import에러남 (0) | 2024.01.11 |