$(document).ready(function() {
/* Init DataTables */
var oTable = $('#district').dataTable();
/* Apply the jEditable handlers to the table */
$('#district', oTable.fnGetNodes()).editable( 'editable_ajax.php', {
tooltip : 'Click cell to edit value...',
indicator : 'Saving...',
style : 'display:block;',
submit : 'OK',
cancel : 'Cancel',
data : " {'PDC 30':'PDC 30','PDC 14':'PDC 14','PDC 81':'PDC 81','PDC 58':'PDC 58'}",
type : 'select',
"Callback": function( sValue, x) {
var aPos = oTable.fnGetPosition( this );
oTable.fnUpdate( sValue, aPos[0], aPos[1]);
/* Redraw the table from the new data on the server */
oTable.fnClearTable( 0 );
oTable.fnDraw();
},
"submitdata": function ( value, settings ) {
var aPos2 = oTable.fnGetPosition( this );
var id2 = oTable.fnGetData( aPos2[0] );
return {
"row_id": this.parentNode.getAttribute('id'),
"id2": id2[0],
"column": oTable.fnGetPosition( this )[ 2 ]
};
},
"height": "14px",
} );
} );
$('.editable').editable('http://www.example.com/save.php', {
type : 'textarea',
submit : 'OK',
callback : function(value, settings) {
console.log(this);
console.log(value);
console.log(settings);
}
});
callback: function( sValue, x) {
var aPos = oTable.fnGetPosition( this );
oTable.fnUpdate( sValue, aPos[0], aPos[1]);
/* Redraw the table from the new data on the server */
oTable.fnClearTable();
oTable.fnDraw();
},
callback : function(sValue, x) {
oTable.fnDraw();
}
$('#idDialog').dialog(
{
autoOpen: true,
width: 500,
height: 400,
modal: true,
buttons:
{
OK: function()
{
$.ajax(
{
url: strUrl, // The URL to update the table
success: function(data)
{
g_oTable.fnReloadAjax();
$('#idDialog').dialog('close');
}
});
},
Close: function()
{
$(this).dialog('close');
}
} // buttons
});
g_oTable = $('#table').dataTable(
{
"bJQueryUI": true,
"bAutoWidth": false,
"iDisplayLength": 100,
"sPaginationType": "full_numbers",
"sAjaxSource": '/ajax/Data.ashx' + window.location.search,
"fnRowCallback": function(oRow, aData)
{
$(oRow).bind('click', function()
{
OpenDialog(aData);
});
},
"callback" : function( sValue, y) {
var aPos = oTable.fnGetPosition( this );
oTable.fnUpdate( sValue, aPos[0], aPos[1] );
},
It looks like you're new here. If you want to get involved, click one of these buttons!
Get useful and friendly help straight from the source.