Hello, i'm implementing a grid with filters in angular 4.0 using Kendo-ui-angular.
I been trying to automatically bind my source of data (API) into the grid data like so:
Service for the API:
public query(state: any): void {
this
.getAll(state)
.subscribe(x =>
super
.next(x));
}
private getAll(state: any): Observable<GridDataResult> {
return
this
.http
.post(
this
.BASE_URL +
'getall'
, state)
.map(response => response.json())
.map(response => (<GridDataResult>{
data: response.result.data,
total: response.result.total
}));
}
And my component:
public ngAfterViewInit(): void {
this
.grid.dataStateChange
.
do
(({ skip, take }: DataStateChangeEvent) => {
this
.gridConfig.skip = skip;
this
.gridConfig.pageSize = take;
})
.
do
(x => console.log(x))
.subscribe(x =>
this
.hrtypeService.query(x));
}
My view:
<
kendo-grid
[data]="listHrType | async"
[pageSize]="gridConfig.pageSize"
[scrollable]="'virtual'"
[skip]="gridConfig.skip"
[sort]="gridConfig.sort"
[rowHeight]="15"
[height]="300"
[selectable]="true"
[filter]="gridConfig.filter"
[filterable]="true"
[groupable]="gridConfig.groupable"
>But i'm having an issue with the filters, everytime i try to filter one of the columns, the object returns just one single colum, and overlaps the remaining one's.
i add 1 filter to the field test_1 and i get
field: "teste_1"
operator:"contains"
value:"teste_value_1"
and once i fill out test_2 with a second filter, it overwrites the first object in the array, instead of adding a second filter
field: "teste_2"
operator:"contains"
value:"teste_value_2"
Opposed to
[field: "teste_1"
operator:"contains"
value:"teste_value_1"]
[field: "teste_2"
operator:"contains"
value:"teste_value_2"]
I'm not manipulating the data, just return what i get from the kendo-ui into my API, what configuration did i missuse?
Apologies beforehead if i made my issue unclear.