fnReloadAjax Issue
fnReloadAjax Issue
Hi, I am new in datatables and quiet happy with this but now stuck in fnReloadAjax plugin. I am pasting my whole code here.
[code]
$(document).ready(function() {
//find all form with class jqtransform and apply the plugin
$.fn.dataTableExt.oApi.fnReloadAjax = function ( oSettings, sNewSource, fnCallback, bStandingRedraw )
{
//alert(sNewSource);
if ( typeof sNewSource != 'undefined' && sNewSource != null )
{
oSettings.sAjaxSource = sNewSource;
}
this.oApi._fnProcessingDisplay( oSettings, true );
var that = this;
var iStart = oSettings._iDisplayStart;
var aData = [];
this.oApi._fnServerParams( oSettings, aData );
oSettings.fnServerData( oSettings.sAjaxSource, aData, function(json) {
/* Clear the old information from the table */
that.oApi._fnClearTable( oSettings );
/* Got the data - add it to the table */
var aData = (oSettings.sAjaxDataProp !== "") ?
that.oApi._fnGetObjectDataFn( oSettings.sAjaxDataProp )( json ) : json;
for ( var i=0 ; i
[code]
$(document).ready(function() {
//find all form with class jqtransform and apply the plugin
$.fn.dataTableExt.oApi.fnReloadAjax = function ( oSettings, sNewSource, fnCallback, bStandingRedraw )
{
//alert(sNewSource);
if ( typeof sNewSource != 'undefined' && sNewSource != null )
{
oSettings.sAjaxSource = sNewSource;
}
this.oApi._fnProcessingDisplay( oSettings, true );
var that = this;
var iStart = oSettings._iDisplayStart;
var aData = [];
this.oApi._fnServerParams( oSettings, aData );
oSettings.fnServerData( oSettings.sAjaxSource, aData, function(json) {
/* Clear the old information from the table */
that.oApi._fnClearTable( oSettings );
/* Got the data - add it to the table */
var aData = (oSettings.sAjaxDataProp !== "") ?
that.oApi._fnGetObjectDataFn( oSettings.sAjaxDataProp )( json ) : json;
for ( var i=0 ; i
This discussion has been closed.
Replies
Allan
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.
Allan
[code]
{"sEcho":1,"iTotalRecords":0,"iTotalDisplayRecords":0,"aaData":[]}
[/code]
so DataTables is showing exactly that - 0 records. So I would guess that there is a fault in the server-side processing script if you are expecting it to return data.
Allan
Can you have a look now. I can see the "Processing". But noting comes. How can I inspect the status?
[code]
$aColumns = array( 'id', 'url', 'photoname', 'description', 'action' );
if($this->input->post('albumid')){
$albumid = $this->input->post('albumid');
}elseif($this->uri->segment(3) != FALSE){
$albumid = $this->uri->segment(3);
}
else{
$albumid = 0;
}
$this->load->model('Photo');
$result = $this->Photo->get_json_images_by_album($albumid);
/*
* Output
*/
$output = array(
"sEcho" => 1,
"iTotalRecords" => count($result),
"iTotalDisplayRecords" => count($result),
"aoData" => array()
);
$aaData = array();
foreach($result as $imagedata){
$row = array();
$row[] = $imagedata->id;
$row[] = "";
$row[] = "".$imagedata->photoname."";
$row[] = "".$imagedata->description."";
$row[] = "DELETE";
$aaData[] = $row;
}
//print_r($result);
$output['aoData'] = $aaData;
echo json_encode( $output );
[/code]
Allan
for ( var i=0 ; i
Where data is what I am expecting?
Is that a correct format of what aData[i] should be?