fnAjaxReload problem with aaData
fnAjaxReload problem with aaData
I am using the plugin to reload ajax content
$.fn.dataTableExt.oApi.fnReloadAjax = function ( oSettings, sNewSource ) {
if ( typeof sNewSource != 'undefined' )
oSettings.sAjaxSource = sNewSource;
this.fnClearTable( this );
this.oApi._fnProcessingDisplay( oSettings, true );
var that = this;
$.getJSON( oSettings.sAjaxSource, null, function(json) {
/* Got the data - add it to the table */
for ( var i=0 ; i
$.fn.dataTableExt.oApi.fnReloadAjax = function ( oSettings, sNewSource ) {
if ( typeof sNewSource != 'undefined' )
oSettings.sAjaxSource = sNewSource;
this.fnClearTable( this );
this.oApi._fnProcessingDisplay( oSettings, true );
var that = this;
$.getJSON( oSettings.sAjaxSource, null, function(json) {
/* Got the data - add it to the table */
for ( var i=0 ; i
This discussion has been closed.
Replies
Regards,
Allan
The problem was in the server.
I solved it,
thanks again.
However, I am having a small problem with retrieving data from my RESTful webservice using ajax.
[code]
function initializeRoleDataTable(){
$('#roleTable').dataTable({
"aaSorting": [[0, "asc"]],
"aoColumns": [null, null, null],
"sPaginationType": "full_numbers",
"bProcessing": true,
"bStateSave": true,
"sAjaxSource": "../rest/roles",
"fnServerData": function(sSource, aaData, fnCallback){
$.ajax({
"dataType": "json",
"type": "POST",
"url": sSource,
"data": aaData,
"success": fnCallback
});
}
});
[/code]
The above is my initialization method that is call in the snipet bellow
[code]
$(function(){
initializeRoleDataTable();
});
[/code]
When the js code is executed, this method
[code]
@SuppressWarnings("unchecked")
@POST
@Path("/roles")
@Produces(MediaType.APPLICATION_JSON)
public String getAllRoles(){
List list = (List) knockageService.findAll(Role.class);
Gson gson = new Gson();
String val = gson.toJson(list);
return val;
}
[/code]
is called.
My Jersey filter logger produce this result
[code]
May 12, 2010 11:13:37 AM com.sun.jersey.api.container.filter.LoggingFilter$Adapter finish
INFO: 1 * Server out-bound response
1 < 200
1 < Content-Type: application/json
1 <
[{"roleName":"ROLE_ADMIN","users":[],"id":497,"creationDate":"May 8, 2010 3:56:43 PM","version":0},{"roleName":"ROLE_USER","users":[],"id":498,"creationDate":"May 8, 2010 3:56:43 PM","version":0},{"roleName":"ROLE_PLAYER","users":[],"id":499,"creationDate":"May 8, 2010 3:56:43 PM","version":0},{"roleName":"ROLE_ANONYMOUS","users":[],"id":500,"creationDate":"May 8, 2010 3:56:43 PM","version":0},{"roleName":"ROLE_POWER","users":[],"id":501,"creationDate":"May 8, 2010 3:56:43 PM","version":0},{"roleName":"ROLE_EXECUTIVE","users":[],"id":502,"creationDate":"May 8, 2010 3:56:43 PM","version":0},{"roleName":"ROLE_PRESIDENT","users":[],"id":503,"creationDate":"May 8, 2010 3:56:43 PM","version":0}]
[/code]
but unfortunately I kept getting the error
[code]
json.aaData is undefined
oSettings.fnServerData(oSettings.sAjax...on){for(var i=0;i