function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
CW83CW83 

pageBlockTable sort controller

I have built a VF page to extend the use of the Mass Edit and Mass Update App from the Force.com Labs to a custom object.  My dilemma is I can't get the table to sort my the "Job Ticket Name"  I have built a "sortExtension" controller, but I don't think that is going to work.  Below is the code for the VF page and the controller. I also don't know if sorting this is even possible since it is input fields.   Any help is greatly appreciated.

 

VF Page

 

<apex:page standardController="Job_Ticket__c" extensions="sortExtension" recordSetVar="unused" sidebar="false">

<!-- for this page to work with a specific custom object, change standController="entityname" to custom object api name  
    For example, if custom object name is Warehouse__c, change first part of the first line to standardController="warehouse__c" -->

    
<apex:includeScript value="{!$Resource.UtilJS}" />
<apex:form >
<apex:pageBlock >
<apex:pageMessages />
<apex:pageBlock >
Note: All modifications made on the page will be lost if Return button is clicked without clicking the Save button first. 
</apex:pageBlock>
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!save}"/>
<apex:commandButton value="Return" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:pageBlockTable value="{!selected}" var="a" id="table">
<apex:column headerValue="Job Ticket Name">
<apex:inputField value="{!a.name}"/>
</apex:column>
<apex:column headerValue="Estimated Start Date">
<apex:inputField value="{!a.Estimated_Start_Date__c}"/>
</apex:column>
<apex:column headerValue="Estimated Hours to Complete">
<apex:inputField value="{!a.Estimated_Hours_to_Complete__c}"/>
</apex:column>
<apex:column headerValue="Estimated Completion Date">
<apex:inputField value="{!a.Estimated_Completion_Date__c}"/>
</apex:column>
<apex:column headerValue="Estimated Resume Date">
<apex:inputField value="{!a.Estimated_Resume_Date__c}"/>
</apex:column>
<apex:column headerValue="Actual Completion Date">
<apex:inputField value="{!a.Actual_date_of_completion__c}"/>
</apex:column>
<apex:column headerValue="Actual Hours to Complete">
<apex:inputField value="{!a.Actual_hours_to_complete__c}"/>
</apex:column>
<apex:column headerValue="Actual Resume Date">
<apex:inputField value="{!a.Actual_Resume_Date__c}"/>
</apex:column>
<apex:column headerValue="Actual Start Date">
<apex:inputField value="{!a.Actual_Start_Date__c}"/>
</apex:column>
<apex:column headerValue="Resource Assigned">
<apex:inputField value="{!a.Resource_Assigned__c}"/>
</apex:column>
<apex:column headerValue="Task Description">
<apex:inputField value="{!a.Task_Description__c}"/>
</apex:column>
<apex:column headerValue="Ticket Status">
<apex:inputField value="{!a.Ticket_Status__c}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

Controller

 

<apex:component >
 public class sortExtension{

public Job_Ticket__c Job Ticket;
public ApexPages.StandardController controller {get; set;}
{
public List<Job_Ticket__c> Job Ticket; public sortExtension (ApexPages.Standardcontroller c)
</Job_Ticket__c>
}
{
this.controller = c; Job Ticket = (Job_Ticket__c)Controller.getRecord(); }
public Job_Ticket__c [ ] getUnitList()
Name = ([Select Name,Estimated_Start_Date__c,Estimated_Hours_to_Complete__c,Estimated_Completion_Date__c,Estimated_Resume_Date__c,Actual_date_of_completion__c,Actual_hours_to_complete__c,Actual_Resume_Date__c,Actual_Start_Date__c,Resource_Assigned__c,Task_Description__c,Ticket_Status__c from Job_Ticket__c Where Job_Ticket__c.Name__r = :TC.id ORDER BY Name]);
return Name;}
</apex:component>