jeditable and fixedcolumns breaks callback
jeditable and fixedcolumns breaks callback
theshiftexchange
Posts: 2Questions: 0Answers: 0
Why does this line
"oTable.fnUpdate( myData.value, aPos[0], aPos[1] );"
fail when I turn FixedColumns on?
In my code, this all works 100% without fixedcolumns. But when I turn fixedColumns on, it all still works (including the alerts), except for the "oTable.fnUpdate( myData.value, aPos[0], aPos[1] );" line?
[code] var oTable = $('#example').dataTable({
"sDom": '<"H"lfrT>t<"F"ip>',
"oTableTools": {
"sSwfPath": "<?=BASE_URL?>assets/swf/copy_csv_xls.swf",
"aButtons": [ "copy", "print", "xls" ]
},
"sScrollX": "100%",
"sScrollY": "450px",
"sPaginationType": "full_numbers",
"bPaginate" :false,
"bJQueryUI": true,
"bScrollCollapse": true } );
new FixedColumns( oTable, {
"iLeftColumns": 4,
"iLeftWidth": 350
} );
/* Apply the jEditable handlers to the table */
$('td.editable', oTable.fnGetNodes()).editable( "<?=BASE_URL?>plannedleave/update_leave_cell", {
data : '<?=$planned_leave_types?>',
type : 'select',
indicator : '',
tooltip : 'Click to edit...',
submit : 'Save',
id : 'elementid',
name : 'newvalue',
"callback": function( data, y )
{
var aPos = oTable.fnGetPosition( this );
var myData = $.parseJSON(data);
if (myData.error == "ok") {
oTable.fnUpdate( myData.value, aPos[0], aPos[1] );
alert ("ok");
} else {
oTable.fnUpdate( this.revert, aPos[0], aPos[1] );
alert(myData.error_msg);
} },
"submitdata": function ( value, settings )
{
return {
"row_id": this.parentNode.getAttribute('id'),
"column": oTable.fnGetPosition( this )[2]
};
},
"height": "14px"
} );[/code]
if I remove
[code]
new FixedColumns( oTable, {
"iLeftColumns": 4,
"iLeftWidth": 350
} );[/code]
Then the callback works exactly as expected - i.e. it inserts "myData.value", and also reverts the selection to what it was if an error was returned.
But if the fixedColumns is turned on, then the alerts still work (i.e. the error message or "ok")- but the value displayed is the full JSON, not just the "myData.value" as it should be?
"oTable.fnUpdate( myData.value, aPos[0], aPos[1] );"
fail when I turn FixedColumns on?
In my code, this all works 100% without fixedcolumns. But when I turn fixedColumns on, it all still works (including the alerts), except for the "oTable.fnUpdate( myData.value, aPos[0], aPos[1] );" line?
[code] var oTable = $('#example').dataTable({
"sDom": '<"H"lfrT>t<"F"ip>',
"oTableTools": {
"sSwfPath": "<?=BASE_URL?>assets/swf/copy_csv_xls.swf",
"aButtons": [ "copy", "print", "xls" ]
},
"sScrollX": "100%",
"sScrollY": "450px",
"sPaginationType": "full_numbers",
"bPaginate" :false,
"bJQueryUI": true,
"bScrollCollapse": true } );
new FixedColumns( oTable, {
"iLeftColumns": 4,
"iLeftWidth": 350
} );
/* Apply the jEditable handlers to the table */
$('td.editable', oTable.fnGetNodes()).editable( "<?=BASE_URL?>plannedleave/update_leave_cell", {
data : '<?=$planned_leave_types?>',
type : 'select',
indicator : '',
tooltip : 'Click to edit...',
submit : 'Save',
id : 'elementid',
name : 'newvalue',
"callback": function( data, y )
{
var aPos = oTable.fnGetPosition( this );
var myData = $.parseJSON(data);
if (myData.error == "ok") {
oTable.fnUpdate( myData.value, aPos[0], aPos[1] );
alert ("ok");
} else {
oTable.fnUpdate( this.revert, aPos[0], aPos[1] );
alert(myData.error_msg);
} },
"submitdata": function ( value, settings )
{
return {
"row_id": this.parentNode.getAttribute('id'),
"column": oTable.fnGetPosition( this )[2]
};
},
"height": "14px"
} );[/code]
if I remove
[code]
new FixedColumns( oTable, {
"iLeftColumns": 4,
"iLeftWidth": 350
} );[/code]
Then the callback works exactly as expected - i.e. it inserts "myData.value", and also reverts the selection to what it was if an error was returned.
But if the fixedColumns is turned on, then the alerts still work (i.e. the error message or "ok")- but the value displayed is the full JSON, not just the "myData.value" as it should be?
This discussion has been closed.
Replies