The step to reproduce the issue:
Go to http://www.telerik.com/kendo-angular-ui/components/grid/data-binding/automatic-operations/ and open the first example in Built-In Directive as plunker
Replace app/app.component.is with the following code
`
import { Component } from '@angular/core';
import { customers } from './customers';
@Component({
selector: 'my-app',
template:
<div><button (click)="reload()">reload</button></div>
<kendo-grid
[kendoGridBinding]="gridData"
[pageSize]="20"
[pageable]="true"
[sortable]="true"
[scrollable]="'virtual'"
[groupable]="true"
[rowHeight]="50"
[height]="510">
<kendo-grid-column field="CompanyName" [width]="140"></kendo-grid-column>
<kendo-grid-column field="ContactName" [width]="120"></kendo-grid-column>
<kendo-grid-column field="City" [width]="100"></kendo-grid-column>
<kendo-grid-column field="ContactTitle" [width]="130"></kendo-grid-column>
</kendo-grid>
})
export class AppComponent {
private gridData: any[] = customers;
reload() {
this.gridData = this.gridData.slice(0, 10);
}
}
`
The code is reformatted by editor in the bug report. Upload the code sample in txt file instead.
As you are resetting the data you will need also to manually reset the skip. To do so you will need to get reference to DataBindingDirective similar to the following:
import { Component, ViewChild } from '@angular/core';
import { customers } from './customers';
import { DataBindingDirective } from '@progress/kendo-angular-grid';
@Component({
selector: 'my-app',
template: `
<div>
<button (click)="reload()">reload</button>
</div>
<kendo-grid
[kendoGridBinding]="gridData"
[pageSize]="20"
[pageable]="true"
[sortable]="true"
[scrollable]="'virtual'"
[rowHeight]="35"
[height]="510">
<kendo-grid-column field="CompanyName" [width]="140"></kendo-grid-column>
<kendo-grid-column field="ContactName" [width]="120"></kendo-grid-column>
<kendo-grid-column field="City" [width]="100"></kendo-grid-column>
<kendo-grid-column field="ContactTitle" [width]="130"></kendo-grid-column>
</kendo-grid>
`
})
export class AppComponent {
@ViewChild(DataBindingDirective) dataBinding: DataBindingDirective;
private gridData: any[] = customers;
reload() {
this.gridData = this.gridData.slice(0, 10);
this.dataBinding.skip = 0;
}
}
A similar problem can be seen in this plunkr. The recommended workaround for the moment is to reset the skip value, as suggested above.
@ViewChild(DataBindingDirective) dataBinding: DataBindingDirective;
You made my day. the document was missing this part @ViewChild(DataBindingDirective) dataBinding: DataBindingDirective
I want to use similar use case as the following link, but with "kendoGridBinding" instead of "data" to be able to use sorting, filtering and other options available in "kendoGridBinding":
but I get the following error:
ERROR
Error: e.slice is not a function
any idea why?
@pedy711 please open a support ticket for assistance with specific component usage.
I can't open the link. Seems to be broken. Can I open a new issue here in Github?
@pedy711 Apologies for the broken link, I've updated it to the correct URL.
Issues logged here should include enough detail for us to reproduce a particular bug.
Most helpful comment
As you are resetting the data you will need also to manually reset the skip. To do so you will need to get reference to
DataBindingDirectivesimilar to the following: