nhn / tui.grid

🍞🔡 The Powerful Component to Display and Edit Data. Experience the Ultimate Data Transformer!
http://ui.toast.com/tui-grid/
MIT License
2.42k stars 394 forks source link

안녕하세요. 셀 선택 시 해당 로우 선택에 대해 질문하고 싶습니다. #1925

Open onionpee opened 1 year ago

onionpee commented 1 year ago

셀 선택 시 해당 로우가 선택되는 방법에 대해 질의하고자 글을 올립니다.

click 이벤트로 접근을 해야하는것인지 아니면 다른 방법이 있는지 궁금합니다.

공식 api 문서를 보고 접근을 하고 있는데 방법이 마땅치 않아 질문드립니다.

norinus commented 1 year ago

https://github.com/nhn/tui.grid/issues/457

참조 다른예)

//클릭이벤트 발생시 grid.on('click', function (ev) {

//선택된 Cell 정보 획득
const {rowKey, columnName} = grid.getFocusedCell();

//특정 컬럼에서만 해당 작업을 하기 윈할때
if(columnName ==='컬럼명'){
    //해당 데이터 획득
    //selectData:는 열의 모든 데이터 {id='1',data1='1111', data2='2222' ...}
    let selectData = grid.getRow(rowKey);
}

});