I have a Visualforce page, which is showing table.
<apex:page controller="TestControllerForIssue">
<style type="text/css">
.myClass { width: 50px; }
</style>
<apex:form >
<apex:pageBlock>
<table>
<tr>
<th style="text-align: center">Quantity</th>
<th style="text-align: center">Edition</th>
</tr>
<tbody>
<tr>
<td><apex:inputText styleClass="myClass" value="{!productQuantity}"/></td>
<td><apex:inputText value="{!model}"/></td>
</tr>
</tbody>
</table>
</apex:pageBlock>
</apex:form>
</apex:page>
It looks like this:
I need to add pageBlockSection.
Added like this:
<apex:page controller="TestControllerForIssue">
<style type="text/css">
.myClass { width: 50px; }
</style>
<apex:form >
<apex:pageBlock>
<apex:pageBlockSection id="productData">
<table>
<tr>
<th style="text-align: center">Quantity</th>
<th style="text-align: center">Edition</th>
</tr>
<tbody>
<tr>
<td><apex:inputText styleClass="myClass" value="{!productQuantity}"/></td>
<td><apex:inputText value="{!model}"/></td>
</tr>
</tbody>
</table>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
After adding the section, the table structure is changed in page.
It is now looking like this:
How should I use the pageBlock section with table so the structure of the table is not changed?
PageBlock -> PageBlockSection -> PageBlockSection -> table
, or you can use PageBlockTable structure.PageBlock -> PageBlockSection -> PageBlockSection -> PageBlockSectionItem -> table
and keep column=1 on PageBlockSection like<apex:PageBlockSection columns="1">