Using Server JSON to change column name
Using Server JSON to change column name
dreamweaverdj
Posts: 2Questions: 0Answers: 0
I'd like to place a column name along with my JSON return, which isn't the problem. I don't know where to HOOK so that I can read the variable and change the column name.
I use fnRender on each column and I'm able to retrieve the json object. How do you do it right before the table renders or right after the table renders?
I would simply like to $('#column2').html(object.customvariable);
I use fnRender on each column and I'm able to retrieve the json object. How do you do it right before the table renders or right after the table renders?
I would simply like to $('#column2').html(object.customvariable);
This discussion has been closed.
Replies
Allan
[code] jukebox=$('#jukebox').dataTable( {
"bProcessing": true,
"sScrollY": "600px",
"bServerSide": true,
"aoColumns":[{"sWidth":"60px"},{"fnRender":function(o,val){return unescape(o.aData[1]);}}],
"sAjaxSource": "/gbmusic.nsf/musicList?open&gb=99&client=guest","iDisplayLength":100,
"bJQueryUI":true,"bFilter":false,"bSort":false,"sPaginationType":"full_numbers",
"fnServerParams": function (aoData) {var x=Math.random();aoData.push({ "name": "list", "value": chart})},
"fnInitComplete":function(oSettings,json){
var t='';
try{t=json.title}catch(e){t=jTitle}
$('#column2').html(t)}
} );
[/code]
Originally I simply tried to alert(json.title) but no such luck (object not found). Then I tried to display the entire object. Object not found.
I have the NAMES of columns as part of the return value. I simply want to grab the values from the json array and use jquery to modify a element.
Thanks,
Allan