问题描述
我正在使用角型剑道网格,在其中使用反应式形式添加带有很少输入控件(文本区域,下拉列表)的内联行。我的情况是我必须在网格中添加一行,然后对其进行编辑。添加行后,有什么方法可以显式触发编辑处理程序。网格的Editrow不能按预期工作。
public addHandler({ sender }: AddEvent): void {
this.closeEditor(sender);
this.formGroup = new FormGroup({
'ActivityAgendaId': new FormControl(''),'Agenda': new FormControl('',[Validators.required,Validators.maxLength(100)]),// 'Category': new FormControl('',Validators.required),'Status': new FormControl("NTDISCUSED",'Mom': new FormControl("",[]),'Action': new FormControl(''),});
this.isNew = true;
if (this.isFutureDatedMeeting()) {
this.formGroup.controls['Status'].disable();
}
this.formGroup.controls['Mom'].disable();
sender.addRow(this.formGroup);
}
private onDocumentClick(e: any): void {
if (this.formGroup && this.formGroup.valid &&
!matches(e.target,'#agendaGrid tbody *,#agendaGrid .k-grid-toolbar .k-button')) {
this.saveRow();
}
}
private saveRow(): void {
if (this.formGroup && !this.formGroup.valid) {
return;
}
if (this.formGroup) {
const selectedAgenda = this.formGroup.getRawValue();
if (this.isNew) {
this.newRowIndex = this.newRowIndex + 1;
selectedAgenda.ActivityAgendaId = this.newRowIndex;
selectedAgenda.Action = ActivityContants.ACTIONINSERT;
this.selectedActivity.agenda.splice(0,selectedAgenda);
} else {
Object.assign(
this.selectedActivity.agenda.find(({ ActivityAgendaId }) => ActivityAgendaId === selectedAgenda.ActivityAgendaId),selectedAgenda
);
}
this.closeEditor(this.grid);
}
}
public editHandler({ sender,columnIndex,rowIndex,dataItem }: CellClickEvent): void {
// if (this.formGroup && !this.formGroup.valid) {
// return;
// }
// this.saveRow();
if (!this.isReadonly) {
this.formGroup = new FormGroup({
'ActivityAgendaId': new FormControl(dataItem.ActivityAgendaId),'Agenda': new FormControl(dataItem.Agenda,// 'Category': new FormControl(dataItem.Category,'Status': new FormControl(dataItem.Status,'Mom': new FormControl(dataItem.Mom,'Action': new FormControl(dataItem.Action),});
this.editedRowIndex = rowIndex;
if (this.isFutureDatedMeeting()) {
this.formGroup.controls['Status'].disable();
this.formGroup.controls['Mom'].disable();
}
sender.editRow(rowIndex,this.formGroup,{ columnIndex });
}
}
private closeEditor(grid: GridComponent,rowIndex: number = this.editedRowIndex): void {
this.isNew = false;
grid.closeRow(rowIndex);
this.editedRowIndex = undefined;
this.formGroup = undefined;
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)