+ Start a Discussion
JosephJJosephJ 

Standardsetcontroller not supported for Task object to do pagination


Want to do pagination on Task object.So far i've implemented inline edit and search box in it.The doc says StandardsetController does not support Task,hence i'm trying to implement it by using Offset.Referring to http://cloudfollowsdotcom.wordpress.com/2012/12/27/soqloffset/ for pagination .How do implement it ? I'm stucked and really pissed off. Experts please help.



 <apex:page standardController="Task" recordSetVar="tasks" extensions="TaskSearchController">
   <apex:enhancedlist type="Activity" height="800" rowsPerPage="50" customizable="False"/>

   <apex:form id="searchForm">
   <apex:PageBlock mode="inlineEdit">      
   <apex:pageblockSection id="searchBlockSection">
      <apex:pageBlockSectionItem id="searchBlockSectionItem">
      <apex:outputLabel >Keyword</apex:outputLabel>
      <apex:panelGroup >
            <apex:inputtext id="searchTextBox" value="{!searchText}">
            </apex:inputtext>
            <apex:commandButton Id="btnSearch" action="{!Search}" rerender="renderBlock" status="status" title="Search" value="Search">                    </apex:commandButton>
        </apex:panelGroup>
    </apex:pageBlockSectionItem>
</apex:pageblockSection>
<apex:actionStatus id="status" startText="Searching... please wait..."/>      
<apex:pageBlocksection id="renderBlock" >
    <apex:pageblocktable value="{!SearchResults}" var="o" rendered="{!NOT(ISNULL(SearchResults))}">
        <apex:outputLink value="/{!o.Id}">{!o.Subject}</apex:outputLink>
        <apex:column value="{!o.Subject}"/>
    </apex:pageblocktable>     
</apex:pageBlocksection>


// apex

public class TaskSearchController
{
   public apexpages.standardController controller{get;set;}
   public Task l;
   public List<Task> searchResults {get; set; }

  public string searchText
  {
   get
   {
     if (searchText==null) searchText = '';
     return searchText;
   }
  set;
   }

public TaskSearchController(ApexPages.StandardController controller)
{
    this.controller = controller;
    this.l = (Task) controller.getRecord();
  }

public PageReference search()
{
  if(SearchResults == null)
  {
    SearchResults = new List<Task>();
  }
else
{
    SearchResults.Clear();
}

  String qry ='Select Id, Subject,Status from Task where Subject like \'%'+searchText+'%\' OR Status like \'%'+searchText+'%\' OR OwnerId like  \'%'+searchText+'%\' Order By Subject,Status';

  SearchResults = Database.query(qry);
  //System.debug(SearchResults);
  return null;
  }
}
Best Answer chosen by JosephJ
Ramu_SFDCRamu_SFDC
Hope this post helps

https://developer.salesforce.com/forums?id=906F000000098QYIAY

All Answers

Ramu_SFDCRamu_SFDC
Hope this post helps

https://developer.salesforce.com/forums?id=906F000000098QYIAY
This was selected as the best answer
JosephJJosephJ
Thankis Ramu  for the link . This is what i was looking for..