Mixing DataTables, KeyTable & jEditable

Mixing DataTables, KeyTable & jEditable

fedorfedor Posts: 2Questions: 0Answers: 0
edited April 2010 in Plug-ins
Hi guys, hi Allan.
Thank you very much for datatables and keytable. It is realy great thing and very usefull. But since i'm a little bit lame in jquery and js at all i've got several problems. I'll appreciate for any advice.
Here's the code i use:
[code]
var oTable3;
$(document).ready(function() {
$("#Fabric tbody").click(function(event) {
$(oTable3.fnSettings().aoData).each(function() {
$(this.nTr).removeClass('row_selected');
});
$(event.target.parentNode).addClass('row_selected');
});

var keys = new KeyTable({
"table": document.getElementById('Fabric'),
"datatable": oTable3
});

oTable3 = $('#Fabric').dataTable({
"sPaginationType": "full_numbers",
"fnDrawCallback": function() {
keys.event.action(null, null, function(nCell) {
keys.block = true;
$(nCell).editable('/ajax_functions/update.aspx', {
callback: function(value, settings) {
keys.block = false;
/*$(this).unbind(settings.event);*/
},
"onreset": function() {
setTimeout(function() { keys.block = false; }, 4);
}
});
setTimeout(function() { $(nCell).click(); }, 4);
});
}
});
});
[/code]
If i edit a cell it becomes 'editable'. And when i click some another cell and then again click previuos cell then it doesn't wait for 'Enter key' to become 'editable' (sorry, english isn't my native language, i hope you'll understand). You can see that i tried [code] $(this).unbind(settings.event); [/code] but it undinds keytable as well. How can i unbind editable and keep keytable binded?
Also, i use code below to add a row:
[code]
function fnClickAddRow(iTable, sqlTable) {
$.ajax({
type: "POST",
url: "/ajax_functions/insert.aspx",
data: "table=" + sqlTable,
success: function(msg) {
iTable.fnAddData([
msg,
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""]);
}
}
});
}
[/code]
Everything is ok, but when i click (with mouse) a cell in newly added row then it doesn't recieve keytable's focus. I tried fnDraw() but it was useless. How can i solve it?

Thank you in advance.

Replies

  • fedorfedor Posts: 2Questions: 0Answers: 0
    edited April 2010
    At least one problem is solved. To make cell uneditable put $(this).editable('disable'); inside callback function. But stiil cannot apply keytable to new row.
This discussion has been closed.