ax5ui / ax5ui-grid

Javascript UI Component - GRID ( Excel Grid, jqGrid, angularjs grid, jquery grid, SlickGrid, ag-grid gridify)
http://ax5.io/ax5ui-grid/demo/index.html
MIT License
99 stars 36 forks source link

트리 클릭시 Cannot read property '__selected__' of undefined #155

Open tpayGhs opened 4 years ago

tpayGhs commented 4 years ago

아래와 같이 트리를 생성했는데 Cannot read property 'selected' of undefined -> ax5grid.js:1972 에러가 납니다. 원인이 뭘까요

this.target = axboot.gridBuilder({ target: $('[data-ax5grid="grid-view-02"]'), showLineNumber: true, showRowSelector: true, header: {align:'center'}, frozenColumnIndex: 3, frozenRowIndex: 2, columns: [ { key: "id", label: "ID", width: 80, styleClass: function () { return "ABC"; }, enableFilter: true, align: "center", editor: { type: "text", disabled: function () { // item, value return false; } } }, {key: "name", label: "Name", align: "left", width: 200, treeControl: true}, { key: "isChecked", label: "Checkbox", width: 50, sortable: false, align: "center", editor: { type: "checkbox", config: {height: 17, trueValue: "Y", falseValue: "N"} } } ], body: { columnHeight: 26, onDataChanged: function () { if (this.key == 'isChecked') { this.self.updateChildRows(this.dindex, {isChecked: this.item.isChecked}); } else if(this.key == 'selected'){ this.self.updateChildRows(this.dindex, {selected: this.item.selected}); } } }, tree: { use: true, indentWidth: 10, arrowWidth: 15, iconWidth: 18, icons: { openedArrow: '', collapsedArrow: '', groupIcon: '', collapsedGroupIcon: '', itemIcon: '' }, columnKeys: { parentKey: "pid", selfKey: "id" } } });

mayoYcat commented 3 years ago

동일한 이슈가 있었는데, 혹시 필요한 분 계실까봐 제가 수정한 내용 답변 남깁니다. ax5grid.js 파일에서 수정했습니다.

var doi = this.proxyList[di].__original_index__; 이부분 확인하시면 됩니다.

( 변경전) while (di--) { if (this.list[doi][cfg.columnKeys.selected]) { pi = this.$.livePanelKeys.length; while (pi--) { this.$.panel[this.$.livePanelKeys[pi]].find('[data-ax5grid-tr-data-index="' + di + '"]').attr("data-ax5grid-selected", false); } } this.proxyList[di][cfg.columnKeys.selected] = false; var doi = this.proxyList[di].__original_index__; }

(변경후) while (di--) { var doi = this.proxyList[di].__origin_index__; if (this.list[doi][cfg.columnKeys.selected]) { pi = this.$.livePanelKeys.length; while (pi--) { this.$.panel[this.$.livePanelKeys[pi]].find('[data-ax5grid-tr-data-index="' + di + '"]').attr("data-ax5grid-selected", false); } } this.proxyList[di][cfg.columnKeys.selected] = false; }