Host multiple properties in one column
Host multiple properties in one column
Hi there, Mr Allan,
I have a table with a lot of columns and I need to save up space. The way it is implemented is having multiple properties in one column, in an Html table that is pre-rendered before applying datatables plugin to it. But now we need to implement AJAX functionality to support large data quantities, and as such we cannot use the pre-rendered Html table. I read a post about using objects when sending JSON to datatables object. Is there a way this could be achieved ?
I have a table with a lot of columns and I need to save up space. The way it is implemented is having multiple properties in one column, in an Html table that is pre-rendered before applying datatables plugin to it. But now we need to implement AJAX functionality to support large data quantities, and as such we cannot use the pre-rendered Html table. I read a post about using objects when sending JSON to datatables object. Is there a way this could be achieved ?
This discussion has been closed.
Replies
when you read the data from the JSON source, you define each column with the mData-property like this
[code]dataTableObject.aoColumns = [{"mData": function ( source, type, val ) {...}}][/code]
Inside the function block you can return any html for the column and point to any JSON property in the source object. In the bottom example, I m creating a link in a column which is invoking a function with parameters (id, start, ende), coming from the original JSON object.
[code]return "".....[/code]