Saturday, 31 August 2013

add aocolumns with $.parseJson() datatables.js

add aocolumns with $.parseJson() datatables.js

I need a little of help here.
I need to fill a table with json from the server, the aaData and
aoColumns, but the thing is that I need a column with a button.
I have this code
$('#divGrid').html('<table cellpadding="0" cellspacing="0"
border="0" class="display" id="example"></table>');
var results=result.split('@_@');
$('#example').dataTable({
"aaData": $.parseJSON(results[0]) ,
, "aoColumns": $.parseJSON(results[1])
});
}
my results are
results[0]="[["jpa","SI","","","","PADILLA",1],["sid","SI","","","","MIRAMONTES",2]]"
results[1]=[{"sTitle":"UserName"},{"sTitle":"ID_CENTRO_TRABAJO"},{"sTitle":"rolName"},{"sTitle":"dominio"},{"sTitle":"recibeAlertas"},{"sTitle":"NOMBRE"},{"sTitle":"edit",
"fnRender": 'function(obj){ return '<input type='button' name='hola'
value='Play'></input>';}'}]"
but my console is clean, no errors are throw. The value apperas but the
button is not.
thanks for any help

No comments:

Post a Comment