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
illini12illini12 

IdeaStandardSetController getResultSize() method returns unexpected results

Working with a large client that is using Ideas Base Theme.  We're having Pagination issues using the IdeaStandardSetController.  We are using the <ideas:listOutputLink> control to pass a status,sort, category, and communityId to navigate to our vforce page that lists the ideas that match the params.  The IdeaStandardSetController for the page seems to read the params for sort,category,community,and status fine and displays the proper ideas that match the parameters.  However, we're trying to display pagination at the bottom of the page that shows "Idea Page 1 of ###".  In order to determine the ### number we're doing a call to the controller.getResultSize() method but it always returns the number for the entire set of all ideas not taking into consideration the parameters for sort,category,status. So even when the IdeaStandardSetController only displays 1 record in the list the getResultSize() method still returns 700+ ideas.

 

Is this a problem with the IdeaStandardSetController or are we just not using it correctly to determine the number of ideas that fit the params?

 

Best Answer chosen by Admin (Salesforce Developers) 
illini12illini12
To put this to rest, here is the answer that came back from the Ideas product team:

 
" Even though the IdeasStandardSetController  extends from the StandardSetController, the implementation is different for the ideas controller and hence the methods which get inherited from StandardSetController will not be in sync with the results from the IdeasStandardSetController. This behavior has been documented in the VisualForce user guide under the IdeasStandardSetController class.

 Unfortunately, the ideas set controller implementation does not give you an option to find out the total number of results in advance.
It supports only pagination of one page at a time."

All Answers

newbiewvfdevnewbiewvfdev
You might be using the wrong method to get the page number. I know StandardSetController has a method called getPageNumber(). Check if IdeaStandardController has something similar.
illini12illini12
To put this to rest, here is the answer that came back from the Ideas product team:

 
" Even though the IdeasStandardSetController  extends from the StandardSetController, the implementation is different for the ideas controller and hence the methods which get inherited from StandardSetController will not be in sync with the results from the IdeasStandardSetController. This behavior has been documented in the VisualForce user guide under the IdeasStandardSetController class.

 Unfortunately, the ideas set controller implementation does not give you an option to find out the total number of results in advance.
It supports only pagination of one page at a time."
This was selected as the best answer
MudasirMudasir

I have the same problem using StandardSetController which I am able to solve by this code:

save your filtered record list in result variable

result = (your sorted records);

controller =newApexPages.StandardSetController(results);

controller.setPageSize(10);

controller.getRecords();