Make column headers text of datatable vertical in runtime

How can the column headers text be set to vertical on click of some button? I could see property “rotate” which does similar thing but I think it needs to be done while initialising data table. Is there any way on run time can we do this ?

You can use the same propety dynamically.

grid.getColumnConfig(id).header[0].rotate = true;
grid.refreshColumns();