Changing the column settings dynamically in code
Changing the column settings dynamically in code
karthi_b
Posts: 3Questions: 0Answers: 0
I want to modify the settings for columns dynamically in the code and would like to referesh the table based on the new settings.
For example,
[code]
var oTable = jQuery('#example').dataTable({'iDisplayLength' : 20});
var oSettings = oTable.fnSettings();
oSettings.aoColumns[1]['sWidth']='20%'; //modify the width of second column
oTable.fnDraw();
[/code]
In the above example, I want to make the second column width as 20% in the code. I tried to set the column attribute and redraw the table. But the changes are not reflected. I am not sure where I am making mistake. Please let me know whether this is possible.
For example,
[code]
var oTable = jQuery('#example').dataTable({'iDisplayLength' : 20});
var oSettings = oTable.fnSettings();
oSettings.aoColumns[1]['sWidth']='20%'; //modify the width of second column
oTable.fnDraw();
[/code]
In the above example, I want to make the second column width as 20% in the code. I tried to set the column attribute and redraw the table. But the changes are not reflected. I am not sure where I am making mistake. Please let me know whether this is possible.
This discussion has been closed.
Replies
Allan