Skip to content

Commit

Permalink
Merge pull request #4123 from SalesforceFoundation/feature/pyan/manag…
Browse files Browse the repository at this point in the history
…e-allocations-page

Move add button from each row in list to bottom of the list
  • Loading branch information
rponti-sforg authored Mar 19, 2019
2 parents 5cb766d + 56d188a commit bf3640a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 21 deletions.
9 changes: 3 additions & 6 deletions src/classes/ALLO_ManageAllocations_CTRL.cls
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,9 @@ public with sharing class ALLO_ManageAllocations_CTRL {
else if (payment!=null)
allo.Payment__c = parentId;

//enable adding to the last row
if (rowNumber == null || rowNumber >= listAllo.size()-1)
listAllo.add(allo);
else
listAllo.add(rowNumber+1, allo);

// always add to last row
listAllo.add(allo);

return null;
}

Expand Down
27 changes: 12 additions & 15 deletions src/pages/ALLO_ManageAllocations.page
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
parentAction="javascript:window.urlHome();" parentRecordName="{!objectName}" parentRecordAction="/{!parentId}"
header="{!pageTitle}" icon="custom" iconCategory="standard" cancelAction="{!cancel}"
saveAction="{!saveClose}" saveReRender="theForm" saveDisabled="{!OR(NOT(isSupportedObject),(opp!=null&&parentAmount==0))}"/>
<c:UTIL_PageMessages />
<c:UTIL_PageMessages id="messages"/>
<div>
<apex:outputPanel id="theTable">
<table class="slds-table slds-table_bordered slds-table_cell-buffer" >
Expand All @@ -168,7 +168,7 @@
<th scope="col"><span class="slds-truncate">{!$ObjectType.Allocation__c.Fields.General_Accounting_Unit__c.Label}</span></th>
<th scope="col" width="250px"><span class="slds-truncate">{!$ObjectType.Allocation__c.Fields.Amount__c.Label}</span></th>
<th scope="col" width="150px"><span class="slds-truncate">{!$ObjectType.Allocation__c.Fields.Percent__c.Label}</span></th>
<th scope="col" width="200px"></th>
<th scope="col" width="100px"></th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -202,14 +202,12 @@
</div>
</td>
<td>
<apex:commandButton styleClass="slds-button slds-button_destructive" value="{!$Label.alloDeleteRow}" id="delRowBTN" title="{!$Label.alloDeleteRow}" action="{!delRow}" reRender="theForm" immediate="true">
<apex:commandButton
styleClass="slds-button slds-button_destructive" value="{!$Label.alloDeleteRow}" id="delRowBTN" title="{!$Label.alloDeleteRow}"
action="{!delRow}" reRender="theTable,messages" immediate="false">
<span class="slds-form-element__label slds-assistive-text">Delete Row {!cnt}</span>
<apex:param name="rowForDel" value="{!cnt}" assignTo="{!rowNumber}"/>
</apex:commandButton>
<apex:commandButton styleClass="slds-button slds-button_neutral" value="{!$Label.alloAddRow}" id="addRowBTN" title="{!$Label.alloAddRow}" action="{!addRow}" reRender="theTable" immediate="true">
<span class="slds-form-element__label slds-assistive-text"><apex:outputText value="{!$Label.alloAddRowAtPosition}"/> {!cnt}</span>
<apex:param name="rowForNew" value="{!cnt}" assignTo="{!rowNumber}"/>
</apex:commandButton>
</td>
</tr>
<apex:variable var="cnt" value="{!cnt+1}"/>
Expand All @@ -226,17 +224,16 @@
</div>
</div>
</td>
<td>
</td>
<td>
<apex:commandButton styleClass="slds-button slds-button_neutral slds-button_small" value="{!$Label.alloAddRow}" id="addRowBTN" title="{!$Label.alloAddRow}" action="{!addRow}" reRender="theTable" immediate="true" rendered="{!listAlloSize==0}">
<span class="slds-form-element__label slds-assistive-text"><apex:outputText value="{!$Label.alloAddRowAtPosition}"/> {!cnt}</span>
<apex:param name="rowForNew" value="{!cnt}" assignTo="{!rowNumber}"/>
</apex:commandButton>
</td>
<td colspan="2"></td>
</tr>
</tbody>
</table>

<!-- Add Row -->
<div class="slds-p-around_medium">
<apex:commandLink action="{!addRow}" immediate="true" reRender="theTable, messages"
value="{!$Label.alloAddRow}" title="{!$Label.alloAddRow}" />
</div>
<script>
window.initOrReload();
</script>
Expand Down

0 comments on commit bf3640a

Please sign in to comment.