feat: add custom data source

Add custom data source to implement server side pagination, sorting and
filtering.
This commit is contained in:
abhay_1806
2018-07-26 19:23:42 +05:30
committed by Abhay Chawla
parent 1a164c1a4b
commit bbbe772515
4 changed files with 128 additions and 46 deletions
+18 -2
View File
@@ -36,8 +36,24 @@ export class AccountingService {
return this.http.get(`/journalentries`, { params: httpParams });
}
getJournalEntries() {
return this.http.get('/journalentries');
// filterBy: officeId, glAccountId, manualEntriesOnly, fromDate, toDate, transactionId
getJournalEntries(filterBy: any, orderBy: any, sortBy: any, offset: number, limit: number) {
console.log('Order By:', orderBy);
console.log('Sort By:', sortBy);
console.log('Filter By:', filterBy);
let httpParams = new HttpParams()
.set('offset', offset.toString())
.set('limit', limit.toString())
.set('sortBy', sortBy)
.set('orderBy', orderBy);
filterBy.forEach(function (filter: any) {
if(filter.value) {
httpParams = httpParams.set(filter.type, filter.value);
}
});
return this.http.get('/journalentries', {
params: httpParams
});
}
revertTransaction(transactionId: string, comments: string) {