KeyTable bug?

KeyTable bug?

NympheasiNympheasi Posts: 24Questions: 0Answers: 0
edited January 2011 in KeyTable
Hi,

I use datatables since a couple of days and i tried to fix an issue with KeyTable and Jeditable.

To reproduce the "bug", i do the the following:

1- Go over a cell and then press "enter"
2- Edit the cell and press "enter" again
3- Go over another cell and then go back to the cell you just edited using your mouse. The cell returns in Jeditable mode but become really editable only if you press "enter".

This happens only when using the mouse to select previously edited cell. If you navigate with arrow keys the problem doesn't occur.

I use the same code as the example here : http://datatables.net/release-datatables/extras/KeyTable/editing.html

I am able to reproduce this even with IE, Firefox or Safari.

Any idea to fix it?

Thanks!

Replies

  • NympheasiNympheasi Posts: 24Questions: 0Answers: 0
    I just found the solution.

    In this example mentioned above uses the jeditable 1.6.2 if i'm not wrong. If you upgrade Jeditable to 1.7.2 and add the folowing line: $(this).editable('destroy');

    [code]
    /* Initialise the Editable instance for this table */
    $(nCell).editable( function (sVal) {
    /* Submit function (local only) - unblock KeyTable */
    keys.block = false;
    $(this).editable('destroy');
    return sVal;
    }, {
    [/code]

    It solves my problem.

    Hope it will helps other people too! :)
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Hi Nympheasi,

    Thanks very much for that. I'll integrate your fix into the demos and upgrade the jEditable that my demos use shortly :-)

    Allan
  • NympheasiNympheasi Posts: 24Questions: 0Answers: 0
    No problem! :)

    By the way, I just saw the new tableTools 2.0. That's great!
  • NympheasiNympheasi Posts: 24Questions: 0Answers: 0
    I'm facing the same bug but this time it's when I hit ESC, go to another cell with my mouse and go back again the cell with my mouse. I tried this but unfortunately it doesn't works:

    [code]
    "onreset": function(){
    /* Unblock KeyTable, but only after this "esc" key event has finished.
    * Otherwise it will "esc" KeyTable as well
    */
    $(this).editable("destroy");
    setTimeout( function () {keys.block = false;}, 0);
    }

    any idea?
    [/code]
  • NympheasiNympheasi Posts: 24Questions: 0Answers: 0
    Found it.

    Replaced
    [code]$(this).editable("destroy");[/code]
    by
    [code]$(nCell).editable("destroy");[/code]
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Hi Nympheasi,

    Thanks very much for this. I've just committed your suggested changed to my examples in git and updated the jEditable source that DataTables comes with - this will all be included in the next release package.

    Regards,
    Allan
  • NympheasiNympheasi Posts: 24Questions: 0Answers: 0
    Hi,

    not sure if this is a problem related to KeyTable, but maybe someone might help me.

    I tried to move the focus on an input text when KeyTable's focus is on a particular cell.

    [code]
    /* Focus on text input on 2nd column */
    keys.event.focus(1,null,function(node){
    $('input',node).focus();
    });
    [/code]

    This code works perfectly in firefox and Chrome but not in IE. Any idea why?
  • azhararmarazhararmar Posts: 6Questions: 0Answers: 0
    @Nympheasi , i had the same issue, and your solution works very well, thank you so much.
This discussion has been closed.