fnCallback is undefined
fnCallback is undefined
I am using fnReloadAjax and data is retrieving properly from the server. But the table is not updating with new data. After debugging I found the value of fnCallback is undefined. My code is as below:
[code]
"bStandingRedraw" : false,
"bJQueryUI" : true,
"sPaginationType" : "full_numbers",
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "<?php echo base_url(); ?>photos/generate_json_photolist/" + sValue,
"fnServerData": function ( sSource, aoData, fnCallback ) {
$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
} );
}
[/code]
And I am calling fnReloadAjax on a change event of a select list. which is also given below:
[code]
$('#albumid').change(function() {
//sValue = $('#albumid').val();
//alert(sValue);
//oTable.fnClearTable();
//oTable.fnClearTable();
oTable.fnReloadAjax("<?php echo base_url(); ?>photos/generate_json_photolist/" + $('#albumid').val() );
});
[/code]
My fnReloadAjax function code is
[code]
$.fn.dataTableExt.oApi.fnReloadAjax = function ( oSettings, sNewSource, fnCallback)
{
console.log("here");
if ( typeof sNewSource != 'undefined' )
{
oSettings.sAjaxSource = sNewSource;
}
console.log(oSettings.sAjaxSource);
this.oApi._fnProcessingDisplay( oSettings, true );
var that = this;
oSettings.fnServerData( oSettings.sAjaxSource, null, function(json) {
/* Clear the old information from the table */
that.oApi._fnClearTable( oSettings );
//alert(json.aaData.length);
/* Got the data - add it to the table */
for ( var i=0 ; i
[code]
"bStandingRedraw" : false,
"bJQueryUI" : true,
"sPaginationType" : "full_numbers",
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "<?php echo base_url(); ?>photos/generate_json_photolist/" + sValue,
"fnServerData": function ( sSource, aoData, fnCallback ) {
$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
} );
}
[/code]
And I am calling fnReloadAjax on a change event of a select list. which is also given below:
[code]
$('#albumid').change(function() {
//sValue = $('#albumid').val();
//alert(sValue);
//oTable.fnClearTable();
//oTable.fnClearTable();
oTable.fnReloadAjax("<?php echo base_url(); ?>photos/generate_json_photolist/" + $('#albumid').val() );
});
[/code]
My fnReloadAjax function code is
[code]
$.fn.dataTableExt.oApi.fnReloadAjax = function ( oSettings, sNewSource, fnCallback)
{
console.log("here");
if ( typeof sNewSource != 'undefined' )
{
oSettings.sAjaxSource = sNewSource;
}
console.log(oSettings.sAjaxSource);
this.oApi._fnProcessingDisplay( oSettings, true );
var that = this;
oSettings.fnServerData( oSettings.sAjaxSource, null, function(json) {
/* Clear the old information from the table */
that.oApi._fnClearTable( oSettings );
//alert(json.aaData.length);
/* Got the data - add it to the table */
for ( var i=0 ; i
This discussion has been closed.
Replies
Probably the best way for us to be able to offer any help is for you to post a link to your page so we can see what is happening.
Allan
You have checked this earlier. Still facing the issue. Here is the link.
URL:
http://www.saifur.com/victor/admin
It will ask for user name and password, use the following credentials.
user: saifur
pass: mankind
then there you will find a menu, go to photo->add new
That is the page I am asking help for.
Thanks in advance.
Given that there is a page refresh, what is fnReloadAjax being used for? Surely since you are reloading the page it will just get the latest data anyway.
Allan
> An unaltered copy of sEcho sent from the client side. This parameter will change with each draw (it is basically a draw count) - so it is important that this is implemented. Note that it strongly recommended for security reasons that you 'cast' this parameter to an integer in order to prevent Cross Site Scripting (XSS) attacks.
Do you really need server-side processing in this table? You should only need it for tables which are many many thousands of records.
Allan