jeudi 3 janvier 2019

Gijgo Angular tree checkboxChange event

In gijgo 3rd party library, there is an Angular TreeView in which I'm trying to add checkboxChange event to the tree configuration object:

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 works fine and the event is also defined in the type definition file

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

    }

but checkboxChange event won't trigger. Plunker




Aucun commentaire:

Enregistrer un commentaire