no message
This commit is contained in:
parent
ab73f2ad62
commit
5340e90c65
|
@ -19,7 +19,7 @@ import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
@NamedEntityGraph(
|
@NamedEntityGraph(
|
||||||
name = "dataManagementPlanListingModel",
|
name = "dataManagementPlanListingModel",
|
||||||
attributeNodes = {@NamedAttributeNode("organisations"), @NamedAttributeNode("researchers"),
|
attributeNodes = {@NamedAttributeNode("organisations"), @NamedAttributeNode("researchers"),
|
||||||
@NamedAttributeNode("project"), @NamedAttributeNode("profile")}
|
@NamedAttributeNode("project"), @NamedAttributeNode("profile"),@NamedAttributeNode("dataset")}
|
||||||
),
|
),
|
||||||
@NamedEntityGraph(
|
@NamedEntityGraph(
|
||||||
name = "fullyDetailed",
|
name = "fullyDetailed",
|
||||||
|
|
|
@ -6,6 +6,8 @@ import eu.eudat.models.helpers.common.Ordering;
|
||||||
import eu.eudat.models.helpers.requests.TableRequest;
|
import eu.eudat.models.helpers.requests.TableRequest;
|
||||||
import eu.eudat.queryable.QueryableList;
|
import eu.eudat.queryable.QueryableList;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
public class PaginationManager {
|
public class PaginationManager {
|
||||||
|
|
||||||
public static <T extends DataEntity<T>> QueryableList<T> applyPaging(QueryableList<T> items, TableRequest tableRequest) throws Exception {
|
public static <T extends DataEntity<T>> QueryableList<T> applyPaging(QueryableList<T> items, TableRequest tableRequest) throws Exception {
|
||||||
|
@ -18,9 +20,34 @@ public class PaginationManager {
|
||||||
public static <T extends DataEntity<T>> void applyOrder(QueryableList<T> items, TableRequest tableRequest) throws Exception {
|
public static <T extends DataEntity<T>> void applyOrder(QueryableList<T> items, TableRequest tableRequest) throws Exception {
|
||||||
ColumnOrderings columnOrderings = tableRequest.getOrderings();
|
ColumnOrderings columnOrderings = tableRequest.getOrderings();
|
||||||
for (Ordering ordering : columnOrderings.getFieldOrderings()) {
|
for (Ordering ordering : columnOrderings.getFieldOrderings()) {
|
||||||
if(ordering.getType() == Ordering.OrderByType.ASC) items.orderByAsc(root -> root.get(ordering.getFieldName()));
|
if (ordering.getOrderByType() == Ordering.OrderByType.ASC)
|
||||||
if(ordering.getType() == Ordering.OrderByType.DESC) items.orderByDesc(root -> root.get(ordering.getFieldName()));
|
applyAscOrder(items,ordering);
|
||||||
|
if (ordering.getOrderByType() == Ordering.OrderByType.DESC) {
|
||||||
|
applyDescOrder(items,ordering);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static <T extends DataEntity<T>> void applyAscOrder(QueryableList<T> items, Ordering ordering) {
|
||||||
|
if (ordering.getColumnType() == Ordering.ColumnType.COUNT) {
|
||||||
|
items.orderBy((builder, root) -> builder.asc(builder.size(root.<Collection>get(ordering.getFieldName()))));
|
||||||
|
} else if (ordering.getColumnType() == Ordering.ColumnType.JOIN_COLUMN) {
|
||||||
|
String[] fields = ordering.getFieldName().split(":");
|
||||||
|
items.orderBy((builder, root) -> builder.asc(root.get(fields[0]).get(fields[1])));
|
||||||
|
} else {
|
||||||
|
items.orderBy((builder, root) -> builder.asc(root.get(ordering.getFieldName())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T extends DataEntity<T>> void applyDescOrder(QueryableList<T> items, Ordering ordering) {
|
||||||
|
if (ordering.getColumnType() == Ordering.ColumnType.COUNT) {
|
||||||
|
items.orderBy((builder, root) -> builder.desc(builder.size(root.<Collection>get(ordering.getFieldName()))));
|
||||||
|
} else if (ordering.getColumnType() == Ordering.ColumnType.JOIN_COLUMN) {
|
||||||
|
String[] fields = ordering.getFieldName().split(":");
|
||||||
|
items.orderBy((builder, root) -> builder.desc(root.get(fields[0]).get(fields[1])));
|
||||||
|
} else {
|
||||||
|
items.orderBy((builder, root) -> builder.desc(root.get(ordering.getFieldName())));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,11 @@ public class ColumnOrderings {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Ordering orderingFromString(String field) throws Exception {
|
private Ordering orderingFromString(String field) throws Exception {
|
||||||
if(field.startsWith("+")) return new Ordering(field.replace("+",""), Ordering.OrderByType.ASC);
|
Ordering ordering = new Ordering(field);
|
||||||
else if(field.startsWith("-")) return new Ordering(field.replace("-",""), Ordering.OrderByType.DESC);
|
if(ordering.getFieldName().contains("+")) ordering.fieldName(ordering.getFieldName().replace("+","")).orderByType(Ordering.OrderByType.ASC);
|
||||||
else throw new Exception("Unsupported Field Order Type");
|
else if(ordering.getFieldName().startsWith("-")) ordering.fieldName(ordering.getFieldName().replace("-","")).orderByType(Ordering.OrderByType.DESC);
|
||||||
|
if(ordering.getFieldName().contains("|count|")) ordering.fieldName(ordering.getFieldName().replace("|count|","")).columnType(Ordering.ColumnType.COUNT);
|
||||||
|
else if(ordering.getFieldName().contains("|join|")) ordering.fieldName(ordering.getFieldName().replace("|join|","")).columnType(Ordering.ColumnType.JOIN_COLUMN);
|
||||||
|
return ordering;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,12 +6,16 @@ public class Ordering {
|
||||||
ASC, DESC
|
ASC, DESC
|
||||||
}
|
}
|
||||||
|
|
||||||
private String fieldName;
|
public enum ColumnType {
|
||||||
private OrderByType type;
|
COUNT, COLUMN , JOIN_COLUMN
|
||||||
|
}
|
||||||
|
|
||||||
public Ordering(String fieldName, OrderByType type) {
|
private String fieldName;
|
||||||
|
private OrderByType orderByType;
|
||||||
|
private ColumnType columnType;
|
||||||
|
|
||||||
|
public Ordering(String fieldName) {
|
||||||
this.fieldName = fieldName;
|
this.fieldName = fieldName;
|
||||||
this.type = type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFieldName() {
|
public String getFieldName() {
|
||||||
|
@ -22,11 +26,34 @@ public class Ordering {
|
||||||
this.fieldName = fieldName;
|
this.fieldName = fieldName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderByType getType() {
|
public OrderByType getOrderByType() {
|
||||||
return type;
|
return orderByType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setType(OrderByType type) {
|
public void setOrderByType(OrderByType orderByType) {
|
||||||
this.type = type;
|
this.orderByType = orderByType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Ordering fieldName(String fieldName) {
|
||||||
|
this.fieldName = fieldName;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Ordering orderByType(OrderByType orderByType) {
|
||||||
|
this.orderByType = orderByType;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ColumnType getColumnType() {
|
||||||
|
return columnType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColumnType(ColumnType columnType) {
|
||||||
|
this.columnType = columnType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Ordering columnType(ColumnType columnType) {
|
||||||
|
this.columnType = columnType;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,9 +27,7 @@ public interface QueryableList<T extends DataEntity<T>> {
|
||||||
|
|
||||||
QueryableList<T> distinct();
|
QueryableList<T> distinct();
|
||||||
|
|
||||||
QueryableList<T> orderByAsc(OrderByPredicate<T> predicate);
|
QueryableList<T> orderBy(OrderByPredicate<T> predicate);
|
||||||
|
|
||||||
QueryableList<T> orderByDesc(OrderByPredicate<T> predicate);
|
|
||||||
|
|
||||||
QueryableList<T> setHints(Set<String> hints);
|
QueryableList<T> setHints(Set<String> hints);
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class QueryableHibernateList<T extends DataEntity<T>> implements Queryabl
|
||||||
private Class<T> tClass;
|
private Class<T> tClass;
|
||||||
private Root<T> root;
|
private Root<T> root;
|
||||||
private List<SinglePredicate<T>> predicates = new LinkedList<>();
|
private List<SinglePredicate<T>> predicates = new LinkedList<>();
|
||||||
private List<Order> orderings = new LinkedList<>();
|
private List<OrderByPredicate<T>> orderings = new LinkedList<>();
|
||||||
private List<Selection> fields = new LinkedList<>();
|
private List<Selection> fields = new LinkedList<>();
|
||||||
private Integer length;
|
private Integer length;
|
||||||
private Integer offset;
|
private Integer offset;
|
||||||
|
@ -93,13 +93,8 @@ public class QueryableHibernateList<T extends DataEntity<T>> implements Queryabl
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public QueryableList<T> orderByAsc(OrderByPredicate<T> predicate) {
|
public QueryableList<T> orderBy(OrderByPredicate<T> predicate) {
|
||||||
this.orderings.add(this.manager.getCriteriaBuilder().asc(predicate.applyPredicate(this.root)));
|
this.orderings.add(predicate);
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public QueryableList<T> orderByDesc(OrderByPredicate<T> predicate) {
|
|
||||||
this.orderings.add(this.manager.getCriteriaBuilder().desc(predicate.applyPredicate(this.root)));
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,10 +115,18 @@ public class QueryableHibernateList<T extends DataEntity<T>> implements Queryabl
|
||||||
return predicates.toArray(new Predicate[predicates.size()]);
|
return predicates.toArray(new Predicate[predicates.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Order[] generateOrderPredicates(List<OrderByPredicate<T>> orderByPredicates, Root<T> root) {
|
||||||
|
List<Order> predicates = new LinkedList<>();
|
||||||
|
for (OrderByPredicate<T> orderPredicate : orderByPredicates) {
|
||||||
|
predicates.add(orderPredicate.applyPredicate(this.manager.getCriteriaBuilder(), root));
|
||||||
|
}
|
||||||
|
return predicates.toArray(new Order[predicates.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
public List<T> toList() {
|
public List<T> toList() {
|
||||||
|
|
||||||
this.query.where(this.generateWherePredicates(this.predicates, this.root));
|
this.query.where(this.generateWherePredicates(this.predicates, this.root));
|
||||||
if (!this.orderings.isEmpty()) this.query.orderBy(this.orderings);
|
if (!this.orderings.isEmpty()) this.query.orderBy(this.generateOrderPredicates(this.orderings, this.root));
|
||||||
TypedQuery<T> typedQuery = this.manager.createQuery(this.query);
|
TypedQuery<T> typedQuery = this.manager.createQuery(this.query);
|
||||||
if (this.offset != null) typedQuery.setFirstResult(this.offset);
|
if (this.offset != null) typedQuery.setFirstResult(this.offset);
|
||||||
if (this.length != null) typedQuery.setMaxResults(this.length);
|
if (this.length != null) typedQuery.setMaxResults(this.length);
|
||||||
|
@ -156,6 +159,8 @@ public class QueryableHibernateList<T extends DataEntity<T>> implements Queryabl
|
||||||
Root<T> criteriaRoot = criteriaQuery.from(this.tClass);
|
Root<T> criteriaRoot = criteriaQuery.from(this.tClass);
|
||||||
|
|
||||||
criteriaQuery.where(criteriaRoot.get("id").in(ids));
|
criteriaQuery.where(criteriaRoot.get("id").in(ids));
|
||||||
|
if (!this.orderings.isEmpty()) criteriaQuery.orderBy(this.generateOrderPredicates(this.orderings, criteriaRoot));
|
||||||
|
|
||||||
TypedQuery<T> typedQuery = this.manager.createQuery(criteriaQuery);
|
TypedQuery<T> typedQuery = this.manager.createQuery(criteriaQuery);
|
||||||
typedQuery.setHint("javax.persistence.fetchgraph", this.manager.getEntityGraph(this.hint));
|
typedQuery.setHint("javax.persistence.fetchgraph", this.manager.getEntityGraph(this.hint));
|
||||||
return typedQuery;
|
return typedQuery;
|
||||||
|
|
|
@ -6,6 +6,6 @@ import javax.persistence.criteria.Path;
|
||||||
import javax.persistence.criteria.Root;
|
import javax.persistence.criteria.Root;
|
||||||
|
|
||||||
public interface OrderByPredicate<T> {
|
public interface OrderByPredicate<T> {
|
||||||
Path applyPredicate(Root<T> root);
|
Order applyPredicate(CriteriaBuilder builder, Root<T> root);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { Field } from '../../models/Field';
|
||||||
import { DataTableRequest } from '../../models/data-table/DataTableRequest';
|
import { DataTableRequest } from '../../models/data-table/DataTableRequest';
|
||||||
import { DatasetListingModel } from '../../models/datasets/DatasetListingModel';
|
import { DatasetListingModel } from '../../models/datasets/DatasetListingModel';
|
||||||
import { DatasetCriteria } from '../../models/criteria/dataset/DatasetCriteria';
|
import { DatasetCriteria } from '../../models/criteria/dataset/DatasetCriteria';
|
||||||
|
@ -84,7 +85,8 @@ export class DatasetListingComponent implements OnInit {
|
||||||
return defaultCriteria;
|
return defaultCriteria;
|
||||||
}
|
}
|
||||||
|
|
||||||
makeItPublic(id:String){debugger;
|
makeItPublic(id: String) {
|
||||||
|
debugger;
|
||||||
this.datasetService.makeDatasetPublic(id).subscribe();
|
this.datasetService.makeDatasetPublic(id).subscribe();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +123,9 @@ export class DatasetDataSource extends DataSource<DatasetListingModel> {
|
||||||
this.isLoadingResults = true;
|
this.isLoadingResults = true;
|
||||||
});
|
});
|
||||||
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
||||||
const request = new DataTableRequest<DatasetCriteria>(startIndex, this._paginator.pageSize);
|
let fields: Array<string> = new Array()
|
||||||
|
if (this._sort.active) fields = this._sort.direction === "asc" ? ["+" + this._sort.active] : ["-" + this._sort.active];
|
||||||
|
const request = new DataTableRequest<DatasetCriteria>(startIndex, this._paginator.pageSize, { fields: fields });
|
||||||
request.criteria = this._criteria.criteria;
|
request.criteria = this._criteria.criteria;
|
||||||
return this._service.getPaged(request);
|
return this._service.getPaged(request);
|
||||||
})
|
})
|
||||||
|
|
|
@ -6,18 +6,18 @@
|
||||||
<mat-card-header>
|
<mat-card-header>
|
||||||
<mat-progress-bar *ngIf="dataSource?.isLoadingResults" mode="query"></mat-progress-bar>
|
<mat-progress-bar *ngIf="dataSource?.isLoadingResults" mode="query"></mat-progress-bar>
|
||||||
</mat-card-header>
|
</mat-card-header>
|
||||||
<mat-table [dataSource]="dataSource" matSort>
|
<mat-table [dataSource]="dataSource" matSort (matSortChange)="refresh()">
|
||||||
|
|
||||||
|
|
||||||
<!-- Column Definition: Name -->
|
<!-- Column Definition: Name -->
|
||||||
<ng-container cdkColumnDef="name">
|
<ng-container cdkColumnDef="name">
|
||||||
<mat-header-cell *matHeaderCellDef mat-short-header="name">{{'DMP-LISTING.COLUMNS.NAME' | translate}}</mat-header-cell>
|
<mat-header-cell *matHeaderCellDef mat-sort-header="label">{{'DMP-LISTING.COLUMNS.NAME' | translate}}</mat-header-cell>
|
||||||
<mat-cell *matCellDef="let row">{{row.label}}</mat-cell>
|
<mat-cell *matCellDef="let row">{{row.label}}</mat-cell>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<!-- Column Definition: Project -->
|
<!-- Column Definition: Project -->
|
||||||
<ng-container cdkColumnDef="project">
|
<ng-container cdkColumnDef="project">
|
||||||
<mat-header-cell *matHeaderCellDef mat-short-header="project">{{'DMP-LISTING.COLUMNS.PROJECT' | translate}}</mat-header-cell>
|
<mat-header-cell *matHeaderCellDef mat-sort-header="|join|project:label">{{'DMP-LISTING.COLUMNS.PROJECT' | translate}}</mat-header-cell>
|
||||||
<mat-cell *matCellDef="let row"> {{row.project}} </mat-cell>
|
<mat-cell *matCellDef="let row"> {{row.project}} </mat-cell>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
<!-- Column Definition: Researchers -->
|
<!-- Column Definition: Researchers -->
|
||||||
<ng-container cdkColumnDef="creationTime">
|
<ng-container cdkColumnDef="creationTime">
|
||||||
<mat-header-cell *matHeaderCellDef mat-short-header="creationTime">{{'DMP-LISTING.COLUMNS.CREATION-TIME' | translate}}</mat-header-cell>
|
<mat-header-cell *matHeaderCellDef mat-sort-header="created">{{'DMP-LISTING.COLUMNS.CREATION-TIME' | translate}}</mat-header-cell>
|
||||||
<mat-cell *matCellDef="let row"> {{row.creationTime | date:'shortDate'}} </mat-cell>
|
<mat-cell *matCellDef="let row"> {{row.creationTime | date:'shortDate'}} </mat-cell>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
|
@ -41,13 +41,13 @@
|
||||||
|
|
||||||
<!-- Column Definition: Version -->
|
<!-- Column Definition: Version -->
|
||||||
<ng-container cdkColumnDef="version">
|
<ng-container cdkColumnDef="version">
|
||||||
<mat-header-cell *matHeaderCellDef mat-short-header="version">{{'DMP-LISTING.COLUMNS.VERSION' | translate}}</mat-header-cell>
|
<mat-header-cell *matHeaderCellDef mat-sort-header="version">{{'DMP-LISTING.COLUMNS.VERSION' | translate}}</mat-header-cell>
|
||||||
<mat-cell *matCellDef="let row"> {{row.version}}</mat-cell>
|
<mat-cell *matCellDef="let row"> {{row.version}}</mat-cell>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<!-- Column Definition: Datasets(count) -->
|
<!-- Column Definition: Datasets(count) -->
|
||||||
<ng-container cdkColumnDef="numOfDatasets">
|
<ng-container cdkColumnDef="numOfDatasets">
|
||||||
<mat-header-cell *matHeaderCellDef mat-short-header="numofdatasets">{{'DMP-LISTING.COLUMNS.DATASETS' | translate}}</mat-header-cell>
|
<mat-header-cell *matHeaderCellDef mat-sort-header="|count|dataset">{{'DMP-LISTING.COLUMNS.DATASETS' | translate}}</mat-header-cell>
|
||||||
<mat-cell *matCellDef="let row"> {{row.numOfDatasets}}</mat-cell>
|
<mat-cell *matCellDef="let row"> {{row.numOfDatasets}}</mat-cell>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
|
|
|
@ -47,8 +47,6 @@ export class DataManagementPlanListingComponent implements OnInit {
|
||||||
this.criteria.setRefreshCallback(() => this.refresh());
|
this.criteria.setRefreshCallback(() => this.refresh());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
refresh() {
|
refresh() {
|
||||||
this.dataSource = new DataManagementPlanDataSource(this.dataManagementPlanService, this._paginator, this.sort, this.languageService, this.snackBar, this.criteria, );
|
this.dataSource = new DataManagementPlanDataSource(this.dataManagementPlanService, this._paginator, this.sort, this.languageService, this.snackBar, this.criteria, );
|
||||||
}
|
}
|
||||||
|
@ -114,7 +112,9 @@ export class DataManagementPlanDataSource extends DataSource<DataManagementPlanL
|
||||||
this.isLoadingResults = true;
|
this.isLoadingResults = true;
|
||||||
});
|
});
|
||||||
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
||||||
const request = new DataTableRequest<DataManagementPlanCriteria>(startIndex, this._paginator.pageSize);
|
let fields: Array<string> = new Array()
|
||||||
|
if (this._sort.active) fields = this._sort.direction === "asc" ? ["+" + this._sort.active] : ["-" + this._sort.active];
|
||||||
|
const request = new DataTableRequest<DataManagementPlanCriteria>(startIndex, this._paginator.pageSize, { fields: fields });
|
||||||
request.criteria = this._criteria.criteria;
|
request.criteria = this._criteria.criteria;
|
||||||
return this._service.getPaged(request);
|
return this._service.getPaged(request);
|
||||||
})
|
})
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
export class ColumnOrderings{
|
||||||
|
public fields:Array<string> = new Array();
|
||||||
|
}
|
|
@ -1,13 +1,15 @@
|
||||||
|
import { ColumnOrderings } from './ColumnOrderings';
|
||||||
import { BaseCriteria } from "../criteria/BaseCriteria";
|
import { BaseCriteria } from "../criteria/BaseCriteria";
|
||||||
import { RequestItem } from "../criteria/RequestItem";
|
import { RequestItem } from "../criteria/RequestItem";
|
||||||
|
|
||||||
export class DataTableRequest<T> extends RequestItem<T> {
|
export class DataTableRequest<T> extends RequestItem<T> {
|
||||||
offset = 0;
|
offset = 0;
|
||||||
length = 0;
|
length = 0;
|
||||||
|
public orderings: ColumnOrderings;
|
||||||
constructor(offset: number, length: number) {
|
constructor(offset: number, length: number, orderings: ColumnOrderings) {
|
||||||
super();
|
super();
|
||||||
this.length = length;
|
this.length = length;
|
||||||
this.offset = offset;
|
this.offset = offset;
|
||||||
|
this.orderings = orderings;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,9 @@ export class ProjectDataSource extends DataSource<ProjectListingModel> {
|
||||||
this.isLoadingResults = true;
|
this.isLoadingResults = true;
|
||||||
});
|
});
|
||||||
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
||||||
const request = new DataTableRequest<ProjectCriteria>(startIndex, this._paginator.pageSize);
|
let fields: Array<string> = new Array()
|
||||||
|
if (this._sort.active) fields = this._sort.direction === "asc" ? ["+" + this._sort.active] : ["-" + this._sort.active];
|
||||||
|
const request = new DataTableRequest<ProjectCriteria>(startIndex, this._paginator.pageSize, { fields: fields });
|
||||||
request.criteria = this._criteria.criteria;
|
request.criteria = this._criteria.criteria;
|
||||||
return this._service.getPaged(request);
|
return this._service.getPaged(request);
|
||||||
})
|
})
|
||||||
|
|
|
@ -53,7 +53,9 @@ export class UsersDataSource extends DataSource<UserListingModel> {
|
||||||
this.isLoadingResults = true;
|
this.isLoadingResults = true;
|
||||||
});
|
});
|
||||||
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
||||||
const request = new DataTableRequest<UserCriteria>(startIndex, this._paginator.pageSize);
|
let fields: Array<string> = new Array()
|
||||||
|
if (this._sort.active) fields = this._sort.direction === "asc" ? ["+" + this._sort.active] : ["-" + this._sort.active];
|
||||||
|
const request = new DataTableRequest<UserCriteria>(startIndex, this._paginator.pageSize, { fields: fields });
|
||||||
request.criteria = this._criteria.getFormData();
|
request.criteria = this._criteria.getFormData();
|
||||||
return this._service.getPaged(request);
|
return this._service.getPaged(request);
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue