Question about adding, and also refreshing datatable on update.

Question about adding, and also refreshing datatable on update.

fffizzzfffizzz Posts: 2Questions: 0Answers: 0
edited February 2012 in General
Ok, first part. I call 4 fields from the DB using sAjaxSource. Im using php, and the table displays great. I hide column one since its the ID column. I added a form and tthe buttons, I only want to submit 3 values. When I submit I get an error stating 3 were submitted, and its expecting 4. How can i get around making it expect the ID column? I even tried adding it as a hidden field, but that didnt work.

Next issue is a little more..
Using sUpdateURL

[code]








$(document).ready( function () {

var oTable = $('#example').dataTable({

"bJQueryUI": true,
"bProcessing": true,
"sAjaxSource": "/test/server_processing.php",
"sPaginationType": "full_numbers",
"aoColumns": [ { "bVisible": false },
null,
null,
null
],
"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",
}).makeEditable({
sAddHttpMethod: "GET",
sDeleteHttpMethod: "GET",
sUpdateHttpMethod: "GET",
sDeleteURL: "DeleteData.php",
sUpdateURL: "UpdateData.php",
sAddURL: "AddData.php",

oAddNewRowButtonOptions: { label: "Add...",
icons: {primary:'ui-icon-plus'}
},
oDeleteRowButtonOptions: { label: "Remove",
icons: {primary:'ui-icon-trash'}
},

oAddNewRowFormOptions: {
title: 'New Toll Free number',
show: "blind",
hide: "explode",
modal: true
},
sAddDeleteToolbarSelector: ".dataTables_length"
});

} );
[/code]

The update works as its supposed to, but the table doesnt refresh. I have literally searched all morning for someone with an example as I would think this is a fairly common setup. I have not come up with anything to get me moving forward unfortunately.

What do I need to do to make it update the table after and ajax inline edit?

Replies

  • fffizzzfffizzz Posts: 2Questions: 0Answers: 0
    why is something so seemingly easy, so difficult for me to make work. Ive literally spent 2 days trying to make the table update after completing an update. (which is does update the db).
This discussion has been closed.