Generating column properties
Generating column properties
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
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
This discussion has been closed.
Replies
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
Thanks a lot for the tip. I've managed to make it work like I wanted.
Tchule.