Generating column properties

Generating column properties

tchuletchule Posts: 2Questions: 0Answers: 0
edited May 2009 in General
Hello,

First, thnaks a lot for this great plugin.

I have a dumb question, Is it possible to generate some properties on the columns (like ALT and TITLE to create a tooltip) when dynamically creating the datatable.

I'm doing something like this :

$('#TableQueryResult').dataTable({
"aaData":result.data,
"aoColumns":result.metadata,
"bFilter": false,
"bLengthChange":false,
"iDisplayLength":50
});

And I have result.metadata generated server-side being something like this :
{'sTitle': label, "sClass": "center", "sType": "numeric"}

I'd like to add a description :
{'sTitle': label, 'sOPTION???': 'title='+description, "sClass": "center", "sType": "numeric"}

Thanks

Replies

  • allanallan Posts: 61,452Questions: 1Answers: 10,055 Site admin
    Hi tchule,

    There are a number of ways to do what you are looking for, but in this case, probably the best way is to use fnInitComplete ( http://datatables.net/usage#fnInitComplete ) to parse through the list of nodes which are created by DataTables for your table display (oSettings.aoData[x].nTr) and modify them.

    Hope this helps,
    Allan
  • tchuletchule Posts: 2Questions: 0Answers: 0
    Hello Allan,

    Thanks a lot for the tip. I've managed to make it work like I wanted.

    Tchule.
This discussion has been closed.