I want to dynamically control table style (height, width etc.). My approach is as below:
Controller
public class Cntl_DynamicTableWidth {
String a{set; get;}
public Cntl_DynamicTableWidth (){
a = 'style= "width:100px; height:200px"';
}
}
VF Page: erroneous
Error: DynamicTableWidth line 3, column 10: Element type "table" must be followed by either attribute specifications, ">" or "/>"
Error Error: Element type "table" must be followed by either attribute specifications, ">" or "/>".
<apex:page controller="Cntl_DynamicTableWidth">
<table {!a} border="1">
<tr>
<th Value="firstCol" >firstCol</th>
<th Value="firstCol" >firstCol1</th>
</tr>
<tr>
<td Value="firstCol" >firstCol</td>
<td Value="firstCol" >firstCol</td>
</tr>
</table>
</apex:page>
Here I have used table. You may provide solutions with any type of tables like datatable etc.
Please let me know how to correct it..
Best Answer
It's failing to compile because it doesn't like the standalone
{!a}
, but with a small change it should work: