首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从Api调用Angular 7的kendo grid保存和取消操作

从Api调用Angular 7的kendo grid保存和取消操作
EN

Stack Overflow用户
提问于 2020-03-14 22:37:05
回答 1查看 307关注 0票数 0

我已经绑定了一个api调用响应到kendo网格,并能够绑定列中的数据,并为我在我的html中绑定的内联编辑做编辑和保存,我看到许多通过组件模板绑定的样本,不确定这是否在我的方法中工作,有人可以给我一些链接,因为我是kendo的新手。我需要获取所有编辑行数据,然后单击保存按钮,它将转到我的put api call.TIA。

我的应用程序

HTML

代码语言:javascript
复制
       <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)
  )
  }
EN

回答 1

Stack Overflow用户

发布于 2020-03-15 02:13:52

你有没有学过剑道的例子here?这是我在应用程序中使用的。在TypeScript的API函数中,将数据发送到您的(save)="saveHandler($event)"服务进行保存。异步视图将在数据发布后自动更新。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60683866

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档