Welcome to Zuora Product Documentation

Explore our rich library of product information

Align the column with the table header

Learn how to align columns with the table header in a template.

When you create a table in the parent template and fetch data using the component template, the columns are not aligned. Following is the workaround to align the columns with the table header.

  1. Add a header in the parent template.
  2. Add a column ‘rownum’ like “<column componentMergeField="true">rownum</column>” in the parent template.
  3. Add the following logic to skip the table in the component template so that the rest of the columns can align with the parent template header.
    <!--RENDER='{{!prefix2.rownum}}'== '0' -->
    <table border="0" cellpadding="0" cellspacing="0" style="width: 100%;"><!--
    ENDRENDER-->

Following is an example code for the parent template:

<style type="text/css">table.table439 {border-collapse: collapse; font-size: 14px;
font-family:Arial Unicode MS,sans-serif; width:100% ;border: 1px solid #C1CED9; }
.table439header {font-size: 14px;text-align: center;padding: 5px 5px;white-space:
normal;word-wrap:break-word;font-weight: normal;background: #F5F5F5; }
</style>
<table border="1" cellpadding="0" cellspacing="0" class="table439">
<tbody>
<tr>
<td class="table439header">Interval Name</td>
<td class="table439header">Condition</td>
<td class="table439header">Charge name</td>
<td class="table439header">Delta Mrr</td>
</tr>
</tbody>
<!--{{! <LineItemsSOQL>
          <class></class>
<ListName>zqu__quotechargeintervaldetail__c</ListName>
          <soql>select 
zqu__QuoteRampInterval__r.name,zqu__QuoteRatePlanCharge__r.name,zqu__QuoteRatePlanCharge__r.
zqu__Total__c,zqu__DeltaMRR__c,zqu__DeltaTCB__c, zqu__EndDate__c, 
zqu__MRR__c,zqu__TCB__c,zqu__ProductRatePlanCharge__r.Name,zqu__StartDate__c from 
zqu__quotechargeintervaldetail__c where 
zqu__QuoteRatePlanCharge__r.zqu__QuoteRatePlan__r.zqu__Quote__c = 
'{{!zqu__Quote__c.Id}}'</soql>
<column componentMergeField="true">rownum</column>
<column componentMergeField="true">zqu__QuoteRampInterval__r.name</column>
<column componentMergeField="true">zqu__QuoteRatePlanCharge__r.name</column>
<column componentMergeField="true">zqu__DeltaMRR__c</column>
<column componentMergeField="true">zqu__DeltaTCB__c</column>
<column componentMergeField="true">zqu__EndDate__c</column>
<column componentMergeField="true">zqu__MRR__c</column>
<column componentMergeField="true">zqu__TCB__c</column>
<component columnFields="true" mergeFieldPrefix="prefix2">Component_Template</component>
<groupbyheader position="after-group">QuoteRampInterval,QuoteRatePlancharge,DeltaMRR,DeltaTCB,EndDate,MRR,TCB</groupbyheader>
<groupby type="onetable">zqu__QuoteRampInterval__r.name</groupby>
<groupbysum position="footer" format-number="#,###.##" prefix="Subtotal $">zqu__QuoteRatePlanCharge__r.zqu__Total__c</groupbysum>
<orderby>zqu__QuoteRampInterval__r.name</orderby>
</LineItemsSOQL> }}-->
</table>

Following is an example code for the component template:

<!--RENDER='{{!prefix2.rownum}}'== '0' -->
<table border="0" cellpadding="0" cellspacing="0" style="width: 100%;"><!--
ENDRENDER-->
<tbody>
<tr>
<td style="font-size: 14px;text-align: center;padding: 2px
2px;white-space: normal;word-wrap:break-word;font-weight:
normal;">{{!prefix2.zqu__QuoteRampInterval__r.name}}</td>
<td style="font-size: 14px;text-align: center;padding: 2px
2px;white-space: normal;word-wrap:break-word;font-weight:
normal;">
<pre>
&lt;!--RENDER='{{!prefix2.zqu__QuoteRatePlanCharge__r.name}}'!= 'New Component' --&gt;
  Condition one true
  &lt;!--ENDRENDER--&gt;
&lt;!--RENDER='{{!prefix2.zqu__QuoteRatePlanCharge__r.name}}'== 'second pp' --&gt; Condition two true &lt;!--ENDRENDER--&gt;
&lt;!--RENDER='{{!prefix2.zqu__QuoteRatePlanCharge__r.name}}'== 'second pp' &amp;&amp; '{{!prefix2.zqu__QuoteRatePlanCharge__r.name}}'== 'New Component' --&gt; Both condition true &lt;!--ENDRENDER--&gt;
</pre>
</td>
<td style="font-size: 14px;text-align: center;padding: 2px
2px;white-space: normal;word-wrap:break-word;font-weight:
normal;">{{!prefix2.zqu__QuoteRatePlanCharge__r.name}}</td>
<td style="font-size: 14px;text-align: center;padding: 2px
2px;white-space: normal;word-wrap:break-word;font-weight:
normal;">{{!prefix2.zqu__TCB__c}}</td>
</tr>
</tbody>
<!--RENDER='{{!prefix2.rownum}}'== '0' -->
</table>
<!--ENDRENDER-->