jeudi 22 septembre 2016

ExtJS: Show/hide control on checkbox selectionchange

I have an ExtJS check-tree ExtJS Check Tree that I am trying to add some control to based on items checked/unchecked. It doesn't seem to fire correctly though.

Here is a Fiddle Example

When I select checkbox 'A', I want to hide the textfield, 'testValue', which works, but then if I unselect checkbox 'A', I want to show the textfield, 'testValue', which does not work.

For this test I am merely looking to see if the selections.selected.length === 0. However, when I unselect any of the checkboxes, the listener does not seem to be firing, since the alert message is not getting triggered - plus, if I then try to reselect the check box again it still does not fire.

I would use a selection Model (as outlined below) to achieve this (since I know it works), but then this places checkboxes on all my tree items when I just want to have the leaf nodes with checkboxes.

selModel: {
        type: 'checkboxmodel',
        listeners: {
            selectionchange: 'onCheckedNodesChange'
        }
    }

Any suggestions would be most welcome!




Aucun commentaire:

Enregistrer un commentaire