В сторонней библиотеке gijgo существует Angular TreeView , в котором я пытаюсь добавить событие checkboxChange
в объект конфигурации дерева:
this.configuration = {
checkboxes: true,
dataSource: [
{ text: 'Node 1', children: [ { text: 'Node 1.1' }, { text: 'Node 1.2' }, { text: 'Node 1.3' } ] },
{ text: 'Node 2', children: [ { text: 'Node 2.1' }, { text: 'Node 2.2' } ] },
{ text: 'Node 3', children: [ { text: 'Node 3.1' }, { text: 'Node 3.2' } ] }
],
uiLibrary: 'bootstrap4',
select: (e, node, id) => {
this.eventLog += '<p>Node with id=' + id + ' is selected.</p>';
},
unselect: (e, node, id) => {
this.eventLog += '<p>Node with id=' + id + ' is unselected.</p>';
},
checkboxChange: (e, $node, record, state) => {
alert('The new state of record ' + record.text + ' is ' + state);
}
};
Пример jQuery работает нормально, и событие также определено в файле определения типа
interface TreeSettings {
...
checkboxChange?: (e: any, node: any, record: any, state: string) => any;
}
, но событие checkboxChange
не сработает при изменении флажка. Plunker