FrontEnd/Ext
extJS에서 checkcolumn의 dataIndex 값 가져오기
ejyoovV
2022. 3. 10. 14:52
✍ dataIndex는 해당하는 컴포넌트의 결과값을 가져올 때 사용할 수 있다.
✍ 예제 ✍
columns에 다음과 같은 아이템이 있다.
{
xtype: 'checkcolumn',
dataIndex: 'testCaseCheckBox',
width: 25,
sortable: false,
header: '',
headerCheckbox: true
},
checkbox가 여러개 있을 때,
체크된 체크박스를 가져오고
그 카운트를 세어
체크된 체크박스가 없을 때,
메시지 박스를 띄운 후 OK 버튼을 클릭했을 때
리턴한다.(창을 닫는다.)
var checkedCount = 0;
var records = this.getView().getStore().getRange();
records.forEach (function (record) {
if (record.get('testCheckBox')) {
checkedCount++;
}
});
if (checkedCount < 1) {
Ext.Msg.show({
width: 250,
title: 'Alert',
msg: 'Check testCheckBox target(s).',
buttonText: {
cancel: 'OK'
}
});
return;
}