Hello,
In a dataquery if I set pagesize before queryOptions (for sorting) api does not consider the setted pagesize, but queryoptions yes.
Only works if I first set the queryOptions and then the PageSize.
Is that so?
Thanks
Hello,
PageSize is a part of the QueryOptions object. I am not sure I understand what you mean by saying “set pagesize before queryOptions”. Both sortBy and pageSize are the properties of the same QueryOptions object.
Mark
Hello Mark, thanks for response.
Example:
Here pagesize does not work:
BackendlessDataQuery dataQuery = new BackendlessDataQuery();dataQuery.setPageSize(50);
QueryOptions queryOptions = new QueryOptions();
queryOptions.addSortByOption( “created DESC” );dataQuery.setQueryOptions( queryOptions );
Here pagesize works:
BackendlessDataQuery dataQuery = new BackendlessDataQuery();
QueryOptions queryOptions = new QueryOptions();
queryOptions.addSortByOption( “created DESC” );dataQuery.setQueryOptions( queryOptions );
dataQuery.setPageSize(50);
It’s working for me in that way, by setting pagesize after queryOptions.
Only to learn even about the API…
When you do this:
BackendlessDataQuery dataQuery = new BackendlessDataQuery();
dataQuery.setPageSize(50);
QueryOptions queryOptions = new QueryOptions();
queryOptions.addSortByOption( "created DESC" );
dataQuery.setQueryOptions( queryOptions );
The queryOptions object you create on line 3 overrides the queryOptions object created internally in dataQuery. You can actually see it right in the source of the SDK:
So if you go with the first approach, it should look like this:
BackendlessDataQuery dataQuery = new BackendlessDataQuery();
dataQuery.setPageSize(50);
dataQuery.getQueryOptions().addSortByOption( "created DESC" );
Sorry I’m starting …
I will check the best documentations.Thanks Mark! =]