Gijgo Angular树checkboxChange事件

时间:2019-01-03 12:12:22

标签: angular checkbox tree

gijgo 3rd party library中,有一个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 example正常工作,并且该事件也在类型定义文件中定义

interface TreeSettings {
        ...
        checkboxChange?: (e: any, node: any, record: any, state: string) => any;

    }

但是checkboxChange事件不会在复选框更改时触发。 Plunker

0 个答案:

没有答案