KeyTable assumes preOpen is never canceled

KeyTable assumes preOpen is never canceled

sliekenssliekens Posts: 97Questions: 17Answers: 2
edited March 2017 in Bug reports

KeyTable assumes that all of its calls to inline are successful. This is problematic when a preOpen is canceled by returning false.

This is the problematic code: https://github.com/DataTables/KeyTable/blob/master/js/dataTables.keyTable.js#L373-L392

KeyTable should listen for the open before doing anything. It also needs to have some way of knowing that preOpen was canceled so that it can stop waiting for the form to open.

Replies

  • sliekenssliekens Posts: 97Questions: 17Answers: 2

    Editor has a similar issue inside closeIcb

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    Good point! Thank you.

    Damn you are good at this ;-).

    I'll get that fixed!

    Allan

  • sliekenssliekens Posts: 97Questions: 17Answers: 2

    Thanks. :smile:

    I think you'd be amazed by all the things we're doing with DataTables/Editor/Select/KeyTable for what was supposed to become a simple CRUD application.
    When you put all those plugins together the way we do, it becomes easier to spot little problems in each plugin because they create a visible/testable impact on the other plugins.

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    What I've done is to add a new cancelOpen event to Editor (which will be in 1.6.2) and I've updated KeyTable to listen for that event and handle it correctly.

    I dithered for way longer than I'd like to admit about if I should use an event called thisOpen (or similar) which would be automatically cleared by Editor if preOpen doesn't allow the open to happen. That would make the client code simpler, and I might put it in in future, but it wouldn't be backwards compatible with old versions of KeyTable at all. Both Editor and KeyTable would have to be updated insync otherwise they just wouldn't work.

    I've also cleared the closeIcb internally.

    Thanks again!
    Allan

This discussion has been closed.