如何在农业网格列中添加日历

时间:2020-08-06 20:48:45

标签: ag-grid ag-grid-angular primeng-calendar

使用此代码日期会出现,但是它隐藏在网格中,不可见, 我正在NgbModal内部使用grind。所以我已经删除了appendTo =“ body”以准备ng日历 this.diagnosticDefs = [

      { headerName: 'Discovery Date', field: 'meddaDtFrom', cellEditor: 'dateEditor' }

]

 this.frameworkComponents = {
      dateEditor: GridDateComponent
    }

grid-date.component.html- GridDateComponent(html)

 <p-calendar class="ui-datepicker" type="number" dateFormat="dd-mm-yy" formControlName="appStartDate" monthNavigator="true" [maxDate]=today
        yearRange="1930:2030" yearNavigator="true" showButtonBar="true">
      </p-calendar>

网格日期组件

export class GridDateComponent implements ICellEditorAngularComp, AfterViewInit {

  @ViewChild("calendar", { static: false }) calendar: Calendar;

  ngAfterViewInit() {
    setTimeout(() => {
      this.calendar.inputfieldViewChild.nativeElement.focus();
    }, 0);
     
  }
}

0 个答案:

没有答案