KeyTable bug?
KeyTable bug?
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!
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!
This discussion has been closed.
Replies
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! :)
Thanks very much for that. I'll integrate your fix into the demos and upgrade the jEditable that my demos use shortly :-)
Allan
By the way, I just saw the new tableTools 2.0. That's great!
[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]
Replaced
[code]$(this).editable("destroy");[/code]
by
[code]$(nCell).editable("destroy");[/code]
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
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?