我已经绑定了一个api调用响应到kendo网格,并能够绑定列中的数据,并为我在我的html中绑定的内联编辑做编辑和保存,我看到许多通过组件模板绑定的样本,不确定这是否在我的方法中工作,有人可以给我一些链接,因为我是kendo的新手。我需要获取所有编辑行数据,然后单击保存按钮,它将转到我的put api call.TIA。
我的应用程序
HTML
<kendo-grid [data]="ForecastProductionQuantity"
[pageSize]="10" [pageable]="true" [resizable]="true"
[scrollable]="scrollable" [filterable]="true"
[height]="650">
<kendo-grid-column field="AmgName">
<ng-template kendoGridHeaderTemplate let-column let-columnIndex="columnIndex">
{{gridHeaders["AmgName"]}}
</ng-template>
</kendo-grid-column>
<kendo-grid-column field="ProdQty.ProdQty0">
<ng-template kendoGridHeaderTemplate let-column let-columnIndex="columnIndex">
{{gridHeaders["ForecastType0"]}}
</ng-template>
</kendo-grid-column>
<kendo-grid-column field="ProdQty.ProdQty1">
<ng-template kendoGridHeaderTemplate let-column let-columnIndex="columnIndex">
{{gridHeaders["ForecastType1"]}}
</ng-template>
</kendo-grid-column>
</kendo-grid>
Component.ts
loadForecastQuantityData() {
//keeping it 0 will be incorporated after Go click is integrated will be changed as per save input
this.allocationSetupID = 0;
return this.restapi.getForecastProductionQuantityData(this.allocationSetupID, this.ForecastID).subscribe((data: {}) => {
this.ForecastProductionQuantity = data;
for (var prod in this.ForecastProductionQuantity) {
this.gridHeaders = {
AmgName: "Amg Name",
ForecastType0: this.ForecastProductionQuantity[prod].Forecast_type.ForecastType0 + " " + this.ForecastProductionQuantity[prod].ProdMonth.ProdMonth0,
ForecastType1: this.ForecastProductionQuantity[prod].Forecast_type.ForecastType1 + " " + this.ForecastProductionQuantity[prod].ProdMonth.ProdMonth1,
}
}
}, (err) => {
console.log(err);
})
}
service.ts
getForecastProductionQuantityData(allocationSetupID: any, ForecastID: any): Observable<any> {
return this.http.get<any>(this.apiURL + '/GetProductionVolume/' + allocationSetupID + '/' +
ForecastID )
.pipe(
retry(1),
catchError(this.handleError)
)
}发布于 2020-03-15 02:13:52
你有没有学过剑道的例子here?这是我在应用程序中使用的。在TypeScript的API函数中,将数据发送到您的(save)="saveHandler($event)"服务进行保存。异步视图将在数据发布后自动更新。
https://stackoverflow.com/questions/60683866
复制相似问题