problem to re-initialize a table
problem to re-initialize a table
Hi everybody,
First of all, Datatables is magic !!!
I have a problem with re-initializing a table. I will explain as clearly as i can because I'm not english, so be kind...
I use the fnDrawCallback to add a button and when It is clicked I update throught the$.ajax a database.
My question is : when the update of the database is done I would like to redraw the table with the data updated so what could be the fonction that I could call in the "success:" part to redraw the table with the uptdated data?
Can someone help me ?
Thanks
$(document).ready(function() {
oTable=$('#the_table').dataTable( {
"bProcessing": true,
"bAutoWidth":false ,
"sPaginationType": "full_numbers",
"bFilter": true,
"aoColumns": [
/* NAME*/ { "bSearchable": true, "bSortable": true,"sWidth":"200px" },
],
"sAjaxSource": "/test",
"fnDrawCallback":function (){
// add a button
$('#bouton').html('');
$(".clickableButton").bind("click", function(){
var btnId = $(this).attr("id");
$('#bouton').html(btnId);
// Ajac call to update the database
$.ajax({
type: "POST",
url: "/calcul",
data: "id="+btnId,
success: function(msg){
/* I would like to put here a function that could re-initialize the table with the data that i updated*/
}
});
});
});
}
First of all, Datatables is magic !!!
I have a problem with re-initializing a table. I will explain as clearly as i can because I'm not english, so be kind...
I use the fnDrawCallback to add a button and when It is clicked I update throught the$.ajax a database.
My question is : when the update of the database is done I would like to redraw the table with the data updated so what could be the fonction that I could call in the "success:" part to redraw the table with the uptdated data?
Can someone help me ?
Thanks
$(document).ready(function() {
oTable=$('#the_table').dataTable( {
"bProcessing": true,
"bAutoWidth":false ,
"sPaginationType": "full_numbers",
"bFilter": true,
"aoColumns": [
/* NAME*/ { "bSearchable": true, "bSortable": true,"sWidth":"200px" },
],
"sAjaxSource": "/test",
"fnDrawCallback":function (){
// add a button
$('#bouton').html('');
$(".clickableButton").bind("click", function(){
var btnId = $(this).attr("id");
$('#bouton').html(btnId);
// Ajac call to update the database
$.ajax({
type: "POST",
url: "/calcul",
data: "id="+btnId,
success: function(msg){
/* I would like to put here a function that could re-initialize the table with the data that i updated*/
}
});
});
});
}
This discussion has been closed.