toast grid에서 input값을 넣을때 자꾸 null이 찍혀서 짜증날때 간편 해결법이 있습니다.
위의 증상이죠.
기본 CustomTextEditor 의 내용을 일부 수정하는 것인데요,
class CustomTextEditor {
constructor(props) {
const el = document.createElement('input');
const {maxLength} = props.columnInfo.editor.options;
el.type = 'text';
el.maxLength = maxLength;
el.value = String(props.value);
this.el = el;
}
getElement() {
return this.el;
}
getValue() {
return this.el.value;
}
mounted() {
this.el.select();
}
}
수정하면 ?
class CustomTextEditor {
constructor(props) {
const el = document.createElement('input');
const {maxLength} = props.columnInfo.editor.options;
el.type = 'text';
el.maxLength = maxLength;
el.value = String(props.value ? props.value: "");
this.el = el;
}
getElement() {
return this.el;
}
getValue() {
return this.el.value;
}
mounted() {
this.el.select();
}
}
기존 코드 : el.value = String(props.value);
이것을 수정해서 : el.value = String(props.value ? props.value: "");
이렇게 되면 되네요^^
반응형
'IT tech Coding > javascript' 카테고리의 다른 글
자바스크립트 코드 나눠서 관리하는 방법 (0) | 2023.03.12 |
---|---|
[javascript] div td 요소를 찾아서 변경하고자 할때 알아두면 좋은 꿀팁 (0) | 2023.03.08 |
git에서 파일 설치하면 dist 폴더는 무슨용도? (0) | 2023.02.27 |
자주만나는 에러 "DevTools failed to load source map: Could not load content for" 없애기 (0) | 2023.02.16 |
[자바스크립트] javascript 창닫기 누른 후 부모창에 작용하는 간단한 방법 (0) | 2023.01.18 |