From 7373b232f945bbb83d92f5032bea78ad0e3f2c07 Mon Sep 17 00:00:00 2001 From: elmot Date: Tue, 16 Aug 2016 15:47:02 +0300 Subject: DataSource backend sorting Change-Id: Ic9e12534cf85f7793a57436e63bd67b6f920f722 --- documentation/datamodel/datamodel-datasources.asciidoc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'documentation') diff --git a/documentation/datamodel/datamodel-datasources.asciidoc b/documentation/datamodel/datamodel-datasources.asciidoc index ddc78bc6cf..997ad20207 100644 --- a/documentation/datamodel/datamodel-datasources.asciidoc +++ b/documentation/datamodel/datamodel-datasources.asciidoc @@ -152,7 +152,7 @@ Information about which items to fetch as well as some additional details are ma [source, java] ---- -DataSource dataSource = new DataSource<>( +DataSource dataSource = new BackendDataSource<>( // First callback fetches items based on a query query -> { // The index of the first item to load @@ -197,7 +197,7 @@ public interface PersonService { int getPersonCount(); - static PersonSort createSort( + PersonSort createSort( String propertyName, boolean descending); } @@ -208,11 +208,11 @@ The sorting options set through the component will be available through [interfa [source, java] ---- -DataSource dataSource = new DataSource<>( +DataSource dataSource = new BackEndDataSource<>( query -> { List sortOrders = new ArrayList<>(); for(SortOrder queryOrder : query.getSortOrders()) { - PersonSort sort = PersonService.createSort( + PersonSort sort = getPersonService().createSort( // The name of the sorted property queryOrder.getSorted(), // The sort direction for this property @@ -220,7 +220,7 @@ DataSource dataSource = new DataSource<>( sortOrders.add(sort); } - return service.fetchPersons( + return getPersonService().fetchPersons( query.getOffset(), query.getLimit(), sortOrders @@ -329,7 +329,7 @@ We can create a helper method for handling the filter since the same logic is ne [source, java] ---- -DataSource dataSource = new DataSource<>( +DataSource dataSource = new BackEndDataSource<>( query -> { BackendFilter filter = query.getFilter(); -- cgit v1.2.3