You need to sign in to do that
Don't have an account?
Dynamic Rows
All,
I have a table built for allocating expenses by company. Right now, all 7 rows are displaying. I would like to only display 2 rows, as a 50/50 allocation is the most likely. If the total doesn't equal 100% after the 1st two allocations, I would like another row to show up until the total equals 100%. Also, I would like a checkbox that allows for an automatic "split evenly". Here is my current code, any help with adding these requests for a better user experience would be great!
Current Screenshot:

Controller:
VF:
I have a table built for allocating expenses by company. Right now, all 7 rows are displaying. I would like to only display 2 rows, as a 50/50 allocation is the most likely. If the total doesn't equal 100% after the 1st two allocations, I would like another row to show up until the total equals 100%. Also, I would like a checkbox that allows for an automatic "split evenly". Here is my current code, any help with adding these requests for a better user experience would be great!
Current Screenshot:
Controller:
public Boolean showCompany {get; set;} public Boolean showAllocation {get; set;} public List <Expense_Line_Items__c> companies {get; set;} public PageReference AllocationTable(){ if(Expense_Line_Items__c.AllocationCheckbox__c = true){ showCompany = true; showAllocation = true; companies = [Select Company__c, Allocation__c From Expense_Line_Items__c]; } else if(Expense_Line_Items__c.AllocationCheckbox__c = false){ return null; } }
VF:
<apex:pageBlockSectionItem > <apex:outputLabel value="{!$ObjectType.Expense_Line_Items__c.Fields.AllocationCheckbox__c.Label}" /> <apex:outputPanel layout="block" styleClass="notrequiredInput"> <apex:inputCheckbox value="{!expenseLineItem.AllocationCheckbox__c}"/> <apex:actionSupport event="onclick" rerender="pbExpenseLineItems"/> </apex:outputPanel> </apex:pageBlockSectionItem> </apex:pageBlockSection> <apex:pageBlockSection title="Allocate Expenses" Columns="1" collapsible="false" rendered="{!(expenseLineItem.AllocationCheckbox__c == true)}"> <apex:outputLabel value="Please choose the percentage of allocation to its corresponding company." /> <apex:pageBlockTable var="company" columns="2" value="{!expenseLineItemContact}"> <table> <apex:column headerValue="{!$ObjectType.Expense_Line_Items__c.Fields.Company__c.Label}" rendered="{!(expenseLineItem.AllocationCheckbox__c == true)}"> <tr> <td><apex:inputField value="{!expenseLineItem.Company__c}"/></td> <td><apex:inputField value="{!expenseLineItem.Allocation__c}"/></td> </tr> <tr> <td><apex:inputField value="{!expenseLineItem.Company__c}"/></td> <td><apex:inputField value="{!expenseLineItem.Allocation__c}"/></td> </tr> <tr> <td><apex:inputField value="{!expenseLineItem.Company__c}"/></td> <td><apex:inputField value="{!expenseLineItem.Allocation__c}"/></td> </tr> <tr> <td><apex:inputField value="{!expenseLineItem.Company__c}"/></td> <td><apex:inputField value="{!expenseLineItem.Allocation__c}"/></td> </tr> <tr> <td><apex:inputField value="{!expenseLineItem.Company__c}"/></td> <td><apex:inputField value="{!expenseLineItem.Allocation__c}"/></td> </tr> <tr> <td><apex:inputField value="{!expenseLineItem.Company__c}"/></td> <td><apex:inputField value="{!expenseLineItem.Allocation__c}"/></td> </tr> <tr> <td><apex:inputField value="{!expenseLineItem.Company__c}"/></td> <td><apex:inputField value="{!expenseLineItem.Allocation__c}"/></td> </tr> </apex:column> </table> <table> <apex:column headerValue="{!$ObjectType.Expense_Line_Items__c.Fields.Allocation__c.Label}" rendered="{!(expenseLineItem.AllocationCheckbox__c == true)}"> </apex:column> </table> </apex:pageBlockTable> </apex:pageBlockSection>
http://bobbuzzard.blogspot.co.uk/2011/07/managing-list-of-new-records-in.html