KeyTable 2.8.0 broken with inline editing

KeyTable 2.8.0 broken with inline editing

bg7bg7 Posts: 44Questions: 6Answers: 0

Link to test case:
http://live.datatables.net/fehuduqa/1/edit

Description of problem:
The latest version of KeyTable (2.8.0) appears to no longer work with inline editing. In the test case linked above, if you update the included version of KeyTable from 2.7.0 to 2.8.0 you can no longer move around in the table with the arrow or tab keys. If you then comment out the editor from the table's key definition here:

keys: {
editor: editor,
},

then KeyTable starts working again. Presumably it's a conflict between the two from a change here:

https://github.com/DataTables/KeyTable/compare/2.7.0...2.8.0

For some reason the live editor imports different versions of plugins than you get when you download releases. In this case the download includes KeyTable 2.8.0 but the live editor pulls in 2.7.0. Is there a way to keep the live editor synced up with the releases? This would make it easier to debug any issues we run into.

Thanks.

Ben

This question has accepted answers - jump to:

Answers

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    Hi Ben,

    With KeyTable active you don't need the inline() call - you can drop that.

    That isn't what is causing the issue though. KeyTable has a "hard edit" mode - you can tell when it is in that mode by the border around the cell going orange. When in that mode the arrow keys move the cursor inside the text area. When in "soft edit", with a blue border, the arrow keys move the focus to a different cell.

    KeyTable will enter the hard edit mode when a double click is detected on a cell - which it sounds like what you are seeing.

    Are you looking for a way to completely disable the hard edit (and thus not have keyboard navigation of the cursor in the input element)?

    Allan

  • bg7bg7 Posts: 44Questions: 6Answers: 0

    Allan,

    I've updated the example to use the current version of KeyTable (2.8.0):

    http://live.datatables.net/fehuduqa/1/edit

    As you can see, if you click on one of the cells and then try to use the arrow keys they don't work properly - it moves the pane instead of moving to the next cell. Commenting out the inline() call doesn't fix that. Am I missing something?

    Thanks.

    Ben

  • bg7bg7 Posts: 44Questions: 6Answers: 0

    Allan,

    I looked through the commits for KeyTable 2.8.0 and I found in this commit:

    https://github.com/DataTables/KeyTable/commit/600317bd1551c37b91169996abe47e04f44060b8

    This block was added:

    /**
    * Whether we perform a key shift action immediately or not depends
    * upon if Editor is being used. If it is, then we wait until it
    * completes its action
    * @param {*} action Function to trigger when ready
    */
    _keyAction: function (action) {
    if (this.c.editor) {
    this.c.editor.submit(action);
    }
    else {
    action();
    }
    },

    I caught it in the debugger and when you're arrowing around the cells the editor exists but there's no mode set (since you've not entered a cell to edit yet). Shouldn't it be checking not just the editor but also the mode? Not sure if it needs to check the editor first as well - I included both to be safe. I'm sure you know better.

    _keyAction: function (action) {
        if (this.c.editor && this.c.editor.mode()) {
            this.c.editor.submit(action);
        }
        else {
            action();
        }
    },
    

    I made that change here and the arrow keys started working again. No clue if this would have any unintended side effects. Again, I'd defer to you of course. Thoughts?

    Thanks.

    Ben

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    Hi Ben,

    You are absolutely right. It should do exactly that and I actually committed that back at the start of January and then completely forgot about that commit. Sorry!

    I'll tag up a release just now.

    Allan

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin
    Answer ✓

    That's KeyTable 2.8.1 available with the fix now.

    Thanks for the prompt to get that release made!

    Allan

  • bg7bg7 Posts: 44Questions: 6Answers: 0

    Allan,

    Just pulled it and it works great - thanks!

    One related question. Is there any way to keep the list of libraries that you can add in live.datatables.net in sync with the current releases? For example, if you want to add in KeyTable right now you get the choice between 2.7.0 and nightly. This was actually part of my confusion at first as I tried to replicate what I was seeing and didn't notice that what I had pulled down from the download page (2.8.0) where it automatically packages all the latest releases (which is very handy) didn't match what I was adding into live.datatables.net (2.7.0). It would make debugging a little easier if they automatically stayed synced up.

    And one quick unrelated question (sorry). I'm updating to the new release from Friday and wanted to use the theme creator with it but it doesn't seem to be entirely working. If I change the "Row selected" color and then click "Create stylesheet" the color for the selected rows in the example table doesn't change and the css it generates doesn't seem to change either. If I change the "Paging button hover" setting however that does seem to update the example table. Is the "Row selected" setting broken?

    Thanks.

    Ben

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    That's something that Colin frequently highlights. The intention is for that to be the case, but it needs me to remember to run a script. I will see if I can automate it.

    Is the "Row selected" setting broken?

    Bother - yes. With the new CSS variable for that option that one is broken at the moment. Will look at it shortly. Sorry!

    Allan

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin
    Answer ✓

    Fixed now :)

    Allan

  • bg7bg7 Posts: 44Questions: 6Answers: 0

    Allan,

    Up and running again here - looks great!

    I'm with Colin on this. Automating syncing the versions in the live editor would be fantastic.

    Thanks.

    Ben

Sign In or Register to comment.