My VF Page Screenshot :
I want to add the following provisions to this VF page
a) selectively delete records (more than one)
b) provide sorting facility in all these columns
My current VF Page code is as follows
<apex:page standardcontroller="Expense__c" extensions="ExpenseController" sidebar="false" showHeader="true" showChat="false" recordSetVar="exp" >
<script src="../../soap/ajax/30.0/connection.js" type="text/javascript"></script>
<apex:form >
<apex:inlineEditSupport />
<apex:pageBlock title="List of Expenses">
<apex:pageBlockTable value="{!exp}" var="item" >
<apex:column value="{!item.Date__c}"/>
<apex:column value="{!item.Type__c}"/>
<apex:column value="{!item.Amount__c}"/>
<apex:column value="{!item.Comments__c}"/>
</apex:pageBlockTable>
<p>Sum of All Expenses : Rs {!SumOfAllExpenses}</p>
</apex:pageBlock>
<apex:commandButton action="{!save}" value="Save" id="theButton1" />
<!--<apex:commandButton value="Total" id="theButton2" onclick="alert('Deleting the expense...')"/>-->
</apex:form>
</apex:page>
If what I ask is a highly involved activity, just plz provide some pointers or clues as to how this can be achieved as I dont want to scrounge up more of your valuable time.
Attribution to: Varun
Possible Suggestion/Solution #1
The normal solution to a) is to add a checkbox to each row. Then the button (such as your delete button) only acts on the selected rows. But a Boolean field is needed to hold the checkbox results and that requires the addition of a wrapper class. You can find many examples by Googling say "apex wrapper class"; here is one example Wrapper Class.
On b) as there is no built in support for column sorting in the standard Apex tags, you have to build something yourself either server-side or client-side. Client-side produces a much more responsive result. I've used both tablesorter and DataTables for this purpose - both build on jQuery. If it is only sorting you need the former does a better job by default of interpreting the column contents.
Attribution to: Keith C
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/32608