Don't user aaData

Don't user aaData

lusabolusabo Posts: 18Questions: 0Answers: 0
edited April 2013 in General
Hi all,

I have this class:

[code]
function Clazz() {
this.id;
this.description;
}

Clazz.prototype._findAll = function(_callback) {

$.ajax({
type : "GET",
url : "api/route",
dataType : "json",
success : function(data) {
_callback(data);
}
});
};
[/code]

I want to load a datatable, so I do this way:

[code]
function loadTable(data){
// Here a I want to load my datatable
}

$(function(){
var clazz = new Clazz();
clazz._findAll(loadTable);
});

[/code]

How can I load the datatable if the data is an array of object like this:

[code][{"id":1,"description":"Test 1"},{"id":2,"description":"Test 2"}][/code]

Thanks,
Luciano

Replies

  • allanallan Posts: 63,522Questions: 1Answers: 10,473 Site admin
    Use mData to reference the object properties: http://datatables.net/blog/Extended_data_source_options_with_DataTables

    Allan
This discussion has been closed.