You need to sign in to do that
Don't have an account?
apex_keen
why ApexPages.StandardSetController is needed ?
New to custom controllers ...Why we needApexPages.StandardSetController while writing custom list controllers ? A simple example I was reading was doing something like this :
public class opportunityList2Con { // ApexPages.StandardSetController must be instantiated // for standard list controllers public ApexPages.StandardSetController setCon { get { if(setCon == null) { setCon = new ApexPages.StandardSetController(Database.getQueryLocator( [select name,closedate from Opportunity])); } return setCon; } set; } // Initialize setCon and return a list of records public List<Opportunity> getOpportunities() { return (List<Opportunity>) setCon.getRecords(); } }
I modified this and inside 'getOpportunities()' function , I directly written that simple query and it was working perfectly fine.
so why need to use 'setcon' property of type ApexPages.Standardsetcontroller and use Database.query locator.. which is making everything look so complex!
Please suggest
I couldn't find any proof for that in the documentation right now, but I am pretty sure that you can only use inlineEditing in pageBlockTables when you iterate over a standardSetController (I once used that in a VF page, but it was some while ago!).
No, you can use inline editing in pageblock tables that use a standard controller
Standard set controller allows for pageination, etc where a standard controller does not. You can also apply filter views etc...
Also, just to make sure your question is covered: You do not HAVE to use a standard set controller in your constructor. You could use a standard controller
but how would you use inlineEditing for lists in a StandardController ? There is only one record inside, as far as I can see.
using an extensions and creating your own lists
Could you maybe provide a short snippet please? I would be definitely interested in your solution, as I didn't like the StandardSetController way, either!
Thank you!! :)
You can do it using the standard controller single record or lists created in your controller extension:
from the docs: