Кендо сетки Сохранить и отменить операцию от вызова API Angular 7 - PullRequest
0 голосов
/ 14 марта 2020

Я ограничил отклик API-вызова на сетку кендо, и я могу связать данные в столбцах и выполнить редактирование и сохранение для встроенного редактирования, которое я связал в моем html, я вижу множество образцов, привязанных через компонент шаблона не уверен, что это работает в моем подходе, может кто-то дать мне несколько ссылок, так как я новичок в кендо. Мне нужно получить все данные строки редактирования, а затем, когда я сохраню кнопку, она перейдет к моему вызову API. 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)
  )
  }

1 Ответ

0 голосов
/ 14 марта 2020

Следовали ли вы примеру Кендо здесь ? Это то, что я использую в своем приложении. В функции (save)="saveHandler($event)" в TypeScript отправьте данные в службу API для сохранения. Асинхронное представление будет автоматически обновляться после публикации данных.

...