Kendo ui 来自Api调用7的剑道网格保存和取消操作
我已经将api调用响应绑定到kendo grid,能够绑定列中的数据,并进行编辑和保存以进行内联编辑,我已经绑定到html中,我看到许多通过组件模板绑定的示例。我不确定这是否在我的方法中起作用。有人能给我一些kendo的新链接吗。我需要获取所有编辑行数据,然后单击“保存”按钮,它将转到我的put api call.TIA 我的申请 HTMLKendo ui 来自Api调用7的剑道网格保存和取消操作,kendo-ui,angular7,webapi,Kendo Ui,Angular7,Webapi,我已经将api调用响应绑定到kendo grid,能够绑定列中的数据,并进行编辑和保存以进行内联编辑,我已经绑定到html中,我看到许多通过组件模板绑定的示例。我不确定这是否在我的方法中起作用。有人能给我一些kendo的新链接吗。我需要获取所有编辑行数据,然后单击“保存”按钮,它将转到我的put api call.TIA 我的申请 HTML {{gridHeaders[“AmgName”]} {{gridHeaders[“ForecastType0”]} {{gridHeaders[“Fore
{{gridHeaders[“AmgName”]}
{{gridHeaders[“ForecastType0”]}
{{gridHeaders[“ForecastType1”]}
组件技术
loadForecastQuantityData(){
//保留0将在Go click集成后合并,并将根据保存输入进行更改
this.allocationSetupID=0;
返回this.restapi.getForecastProductionQuantityData(this.allocationSetupID,this.ForecastID)。订阅((数据:{})=>{
this.ForecastProductionQuantity=数据;
for(本预测生产数量中的var prod){
this.gridHeaders={
AmgName:“Amg名称”,
ForecastType0:this.ForecastProductionQuantity[prod].Forecast\u type.ForecastType0+“”+this.ForecastProductionQuantity[prod].ProdMonth0,
ForecastType1:this.ForecastProductionQuantity[prod].Forecast\u type.ForecastType1+“”+this.ForecastProductionQuantity[prod].ProdMonth1,
}
}
},(错误)=>{
控制台日志(err);
})
}
服务台
getForecastProductionQuantityData(allocationSetupID:any,ForecastID:any):可观察{
返回此.http.get(this.apirl+'/GetProductionVolume/'+allocationSetupID+'/'+
预言家)
.烟斗(
重试(1),
catchError(this.handleError)
)
}
你有没有遵循剑道的榜样?这是我在应用程序中使用的。在TypeScript中的(save)=“saveHandler($event)”
函数中,将数据发送到API服务进行保存。异步视图将在数据发布后自动更新 是的,我们已经看到了这个示例,您是否介意分享一个示例api调用,说明在我无法将fetch方法与callback绑定时如何读取数据。TIA@user12093961我们使用IIS托管的.NET中的ODataV4作为REST后端;Telerik的Northwind示例后端也使用OData。谢谢,我能够将我更改的Jsonp请求的数据绑定到Json get并能够绑定,但是在save中,您是否打算在按钮单击事件中使用saveHandler($event)而不是saveChanges(网格)@user12093961您需要使用进行在线编辑。它触发save
事件,该事件依次调用函数saveHandler
。
<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)
)
}