剑道网格不hightlight入围行/失踪UI刷新
问题描述:
我有一个剑道网:剑道网格不hightlight入围行/失踪UI刷新
<kendo-grid
[data]="gridData"
[pageSize]="state.take"
[skip]="state.skip"
[sort]="state.sort"
[filter]="state.filter"
[sortable]="true"
[pageable]="true"
[filterable]="true"
[kendoGridSelectBy]="'guid'"
[selectable]="true"
[selectedKeys]="selectionCustomer"
(dataStateChange)="dataStateChange($event)"
>
<kendo-grid-checkbox-column></kendo-grid-checkbox-column>
<kendo-grid-column field="name" title="Name"></kendo-grid-column>
<kendo-grid-column field="prename" title="Prename"></kendo-grid-column>
<kendo-grid-column field="companyName" title="CompnayName"></kendo-grid-column>
<kendo-grid-column field="number" title="number"></kendo-grid-column>
<kendo-grid-column field="fullname" title="Fullname"></kendo-grid-column>
</kendo-grid>`
随着从API组件加载数据(如数组,因为没有可用的OData)
export class CustomerKendoComponent implements OnInit {
private state: State = {
skip: 0,
take: 10,
};
private customers: Customer[] = [];
private gridData: GridDataResult = null;
private selectionCustomer: number[] = [];
constructor(
private customerApi: CustomerApi,
private ref: ChangeDetectorRef,
) { }
ngOnInit() {
this.customerApi.apiCustomerGet().subscribe(response => {
this.customers = response.customers;
this.gridData = process(this.customers, this.state);
this.ref.detectChanges();
})
}
printSelection() {
console.log(this.selectionCustomer);
}
}
如果我点击一行,没有任何反应。 没有错误,没有选择。
要找到问题,我在UI上添加了一个按钮,打印出所选的行GUID。
<button md-raised-button color="primary" (click)="printSelection()">print</button>
如果我按下按钮,控制台将打印出正确的GUID,并且该行会被加亮!但只有当我按下按钮。
我看不出有什么更多的文档在这里https://www.telerik.com/kendo-angular-ui/components/grid/selection/ 我也尝试过selectableSetting,但没有任何改变。
为什么我的网格选择不会触发“UI刷新”?
版本
"@progress/kendo-angular-grid": "^1.4.2",
"@angular/core": "~4.3.1",
对不起重用angular2标签,我不能创建一个新的标签对剑道的UI-angular4
答
似乎问题是:
changeDetection: ChangeDetectionStrategy.OnPush,
另一个拷贝过去的问题没有检查文件它真的做什么...