Right now I have a datatable, some fields are editable, some are not. I have the following code (taken from tabbing between jeditable fields in a table):
$('#table .select').bind('keydown', function(evt) {
if(evt.keyCode==9) {
console.log("next");
var nextBox='';
var currentBoxIndex=$("#table .select").index(this);
console.log("currentBoxIndex",currentBoxIndex);
if (currentBoxIndex == ($("#table .select").length-1)) {
nextBox=$("#table .select:first"); //last box, go to first
console.log("nextBox", nextBox);
} else {
nextBox=$("#table .select").eq(currentBoxIndex+1); //Next box in line
console.log("nextBox", nextBox);
}
$(this).find("#table .select").blur();
$(nextBox).click(); //Go to assigned next box
return false; //Suppress normal tab
};
});
This works great for tabbing to each editable field! Except one issue: I need to be able to tab to the field, select a value from a dropdown in the editable field, and then be able to tab. Right now I can tab through each one if I don't change the value in the field. If I change the value, the tabbing will stop and I have to re-click on the next field. Help?
I'm using:
datatables - http://datatables.net/
Bootstrap
jquery jeditable
I found the solution.