I am trying to implement a simple paginator that uses a wrapper object to move between pages, but I am not sure how to get the wrapper class to work in the component controller. Specifically my questions are:
- How to invoke the inner-class method
void next()
from the component controller, given it is not a getter? - Can I call non-Aura methods from the component controller?
- Can I call non-static methods from the component controller?
The documentation clearly answers questions 2 & 3 with a "no," but I wanted to be sure just in case there were exceptions to the rule.
The following code is not compiling with this error:
AuraEnabled methods must be named with a prefix 'get'
public class PageController
{
@AuraEnabled
public static QueryCursor getAccounts()
{
return new QueryCursor();
}
public class QueryCursor
{
private Integer m_pageNumber;
public QueryCursor()
{
m_pageNumber = 1;
}
@AuraEnabled
public Account[] accounts
{
get { return queryAccounts(m_pageNumber); }
private set;
}
@AuraEnabled
public void next()
{
m_pageNumber++;
}
private Account[] queryAccounts(pageNumber)
{
// return Accounts with an offset
}
}
}
I understand why I'm getting the error, but I don't want to change the signature from void next()
to Account[] getNext()
. What's the best way to go about this?
OFFSET
keyword and is beyond the 10,000 limit of the StandardSetController, there isn't really an APEX equivalent.