check box update on keytable

check box update on keytable

jyothisrinivasjyothisrinivas Posts: 3Questions: 0Answers: 0
edited October 2012 in KeyTable
Hi,

I have a datatable, which is a key table. I am trying to update checkbox value for each row. If user enters the enter key or space bar checkbox has to update to checked or unchecked. If it is checked, i am trying to call server function. But I am not able achieve this.
Can you please advise on this? what wrong am I doing? thanks in advance.

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

keys.event.focus(7, null, function (e, x, y) {
var row = $(this).parents('tr');
var aPos = keys.fnGetCurrentPosition(this);
var aData = keys.fnGetCurrentData(aPos[0]);
aData[aPos[1]] = 'clicked';
this.innerHTML = 'clicked';
aData = 'clicked';
var result = oTable.fnUpdate("", aPos[0], aPos[1]);
alert(result);
var ckbox = $(this);
$(document).keydown(function (event) {
if (event.keyCode == 13 || event.keyCode == 32) {
var isChecked = $(ckbox).prop('checked');
var sData = $(ckbox, oTable.fnGetNodes()).each(function (i) {
alert("checkbox status " + sData);
});
if (isChecked) {
$(this).attr('checked', false);
// alert("unchecked");
}
else {
$(this).prop("checked", true);
row.find('.reconcile').prop('checked', true);
$.fn.reconcile($(this).parents('tr'));
}
}
});
});
This discussion has been closed.