You need to sign in to do that
Don't have an account?
Chad Ritchie
Basic Visualforce DataTable Filter
Hey Salesforce Community,
Does anyone know how I could add a simple filter to both of these datatables?
For example the first one I'd like to add a filter allowing only balances__c>0 only.
I'm using a standard controller, and would ideally like to avoid using a custom controller to solve this.
<table>
<tr>
<td>
<apex:dataTable value="{!Contact.Positions__r}" var="b" rules="all" columns="3" columnsWidth="250px,250px" align="left"
columnClasses="columnBorders" headerClass="dataTableHeader" cellpadding="5px" cellspacing="0">
<apex:column value="{!b.Product__r.Name}" headerValue="Product" />
<apex:column value="{!b.Name}" headerValue="Account Name"/>
<apex:column value="{!b.Balance__c}" headerValue="Balance"/>
</apex:dataTable>
</td>
<td>
<apex:dataTable value="{!Contact.Transactions__r}" var="b" rules="all" columns="3" columnsWidth="250px,250px" align="left"
columnClasses="columnBorders" headerClass="dataTableHeader" cellpadding="5px" cellspacing="0">
<apex:column value="{!b.Product__r.Name}" headerValue="Product" />
<apex:column value="{!b.Investor_Account_Name__c}" headerValue="Account Name"/>
<apex:column value="{!b.Gross_Amount__c}" headerValue="Gross Amount"/>
</apex:dataTable>
</td>
</tr>
</table>
Thanks!
Does anyone know how I could add a simple filter to both of these datatables?
For example the first one I'd like to add a filter allowing only balances__c>0 only.
I'm using a standard controller, and would ideally like to avoid using a custom controller to solve this.
<table>
<tr>
<td>
<apex:dataTable value="{!Contact.Positions__r}" var="b" rules="all" columns="3" columnsWidth="250px,250px" align="left"
columnClasses="columnBorders" headerClass="dataTableHeader" cellpadding="5px" cellspacing="0">
<apex:column value="{!b.Product__r.Name}" headerValue="Product" />
<apex:column value="{!b.Name}" headerValue="Account Name"/>
<apex:column value="{!b.Balance__c}" headerValue="Balance"/>
</apex:dataTable>
</td>
<td>
<apex:dataTable value="{!Contact.Transactions__r}" var="b" rules="all" columns="3" columnsWidth="250px,250px" align="left"
columnClasses="columnBorders" headerClass="dataTableHeader" cellpadding="5px" cellspacing="0">
<apex:column value="{!b.Product__r.Name}" headerValue="Product" />
<apex:column value="{!b.Investor_Account_Name__c}" headerValue="Account Name"/>
<apex:column value="{!b.Gross_Amount__c}" headerValue="Gross Amount"/>
</apex:dataTable>
</td>
</tr>
</table>
Thanks!
Do the rendered in the columns then:
Good luck and if it helps please mark as correct so the question can be solved for others.
All Answers
I tried this:
But I seemed to get this error: <apex:column> must be the direct child of either <apex:dataTable> or <apex:pageBlockTable>
Any idea on that?
If it helps please like or mark a correct.
Good luck!
Still seem to be getting that error though, seems to be implying that the <column> must be right below the DataTable, and therefore the outputtext is getting in the way?
I appreciate the help!
Do the rendered in the columns then:
Good luck and if it helps please mark as correct so the question can be solved for others.