DT Editor + Keytable - Possible bug

DT Editor + Keytable - Possible bug

daveihdaveih Posts: 8Questions: 3Answers: 0
edited June 26 in Bug reports

I am using the DT Editor (1.9.4) in combination with a KeyTable (DT 1.10.20) to get an Excel-like inline editing features.
Only some columns in my table are editable.
It works fine with arrow-navigation. One can reach only the cells which are allowed to be focused on with my KeyTable columns option. Only the cells with the classes editable and inline can gain focus.

keys: {
    columns: '.editable.inline',
    editor: this.editor
}

The problem arises on cell double-click that triggers inline editing.
When double-clicking on a cell that's editable and therefore able to gain focus, the inline editing is triggered correctly.
However, when double-clicking on a cell that's not editable (does not fulfil the keys columns option), the Editor still tries to trigger inline-editing and fails, as there is no cell in-focus.
This is the error thrown:

Error in KeyTable source:

The function tries to get the reference to the lastFocused cell, but as the focus on the clicked cell is disabled, it's null.

Furthermore, while focused on any cell, and double clicking on a non-focusable cell, the inline editing is triggered on the focused cell, which is unexpected behaviour.

I am relying only on the native key/mouse events and handlers provided by the KeyTable - I am not implementing my own on click or dblclick listeners to trigger inline edit. For that reason, I suspect this is a bug. Unless I am doing something wrong ? Let me know please

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 9,003Questions: 0Answers: 1,501

    I tried it here, using this example, and it seems to work as expected. The first column isn't clickable, and doesn't generate an error.

    Could you look at that, please, and see if it helps. If it's still not working for you, please can you update my example, or link to your page, so that we can see the problem.

    Cheers,

    Colin

  • daveihdaveih Posts: 8Questions: 3Answers: 0
    edited June 29

    Here it is, recreated.
    I had to downgrade the version of DT (to 1.10.20) and KeyTable (to 2.5.1) in the demo to recreate the error. When you double-click on a non-editable cell with no cell focused on, you'll see the error in your browser console.
    Also, when you focus on one cell and double click on a non-editable cell, the edit will be triggered on the focused cell, which is not necessarily an error, but unexpected behaviour, in my opinion.

    **I solved it on my side by upgrading DT to 1.10.21 and KeyTable to 2.5.2, the error is no longer present. **

  • colincolin Posts: 9,003Questions: 0Answers: 1,501

    OK, thanks for that. So, to be clear, are you saying with the most recent version all your problems are resolved?

    Colin

  • daveihdaveih Posts: 8Questions: 3Answers: 0

    The error doesn't appear anymore after the update.
    However, the second aforementioned case is still present -

  • colincolin Posts: 9,003Questions: 0Answers: 1,501

    Ah, OK. I wasn't seeing that on my test case above, which was using the latest versions. Please could you modify that again to demonstrate the issue,

    Colin

  • daveihdaveih Posts: 8Questions: 3Answers: 0

    It occurs in your first example with the latest versions too.

    Example to recreate:
    Focus onto the Age cell in the first row (click once).
    Now double click on e.g., Bruno Nash's name cell. Inline edit is initiated on the focused Age cell in the first row.

  • allanallan Posts: 51,926Questions: 1Answers: 7,874 Site admin
    Answer ✓

    Perfect thanks for the instructions! That's it fixed now - it will be in the nightly shortly.

    Regards,
    Allan

Sign In or Register to comment.