Kendo-UI Angular复选框验证

时间:2018-07-20 13:29:52

标签: angular typescript kendo-ui

您好,我们在项目中使用剑道网格进行角度绘制。我创建了公共帮助程序组件(以后使用选择器名称代替kendo-grid)。如果我选择相同的枚举值(在我们的示例中为5个枚举值,并且与数据库中的某些ID相关),我想进行验证:例如(如果选择了enum.x,则应选择其他带有其他枚举值的行) )

1)-我的html

<div class="formWindow">
<kendo-window [title]="title" *ngIf="opened==true" (close)="opened=false"
              [minWidth]="450">
    <kendo-grid [data]="data$ | async"
                [pageSize]="grid.take"
                [skip]="grid.skip"
                [sort]="grid.sort"
                [sortable]="true"
                [pageable]="{buttonCount:5, pageSizes:true}"
                [scrollable]="'none'"
                (dataStateChange)="onGridUpdate($event)"
                [selectable]="selectableSettings"
                (selectionChange)="onGridSelectionChange($event)"
                [kendoGridSelectBy]="'Id'"
                [selectedKeys]="selection">
    </kendo-grid>
    <kendo-grid-checkbox-column title="Custom checkbox" i18n-title>
        <ng-template kendoGridCellTemplate let-idx="rowIndex">
            <input [kendoGridSelectionCheckbox]="idx" />
        </ng-template>
    </kendo-grid-checkbox-column>
</kendo-window>

2)---我的组件

@Component({
    selector: 'select-statement-dialog',
     templateUrl: './select-statement-dialog.component.html',
    styleUrls: ['./select-statement-dialog.component.less']
     })




export class SelectStatementDialogComponent implements OnInit {

@Input() title: string = 'Select statement';
@Input() id: any
@Input() selection: number[] = [];  
selectedRows: IFinStatOverviewResDto[] = [];
disableRows: any[] = [];
select: SelectionEvent
grid: State = {
    take: 10
};
data$: Observable<GridDataResult>;
public checkboxOnly = false;
public mode: SelectableMode;
public selectableSettings: SelectableSettings;

constructor() {
    this.setSelectableSettings(1);
}

public setSelectableSettings(templateId ): any {
    this.selectableSettings = {
        checkboxOnly: this.checkboxOnly,
        mode: this.mode
    };
    if (this.selectedRows[0].TemplateId >= 1) {
        this.selectedRows.find(x => x.TemplateId == templateId)
    }
    else {
        //
    }
}

ngOnInit() {
}

}

我想使用kendoGridSelectionCheckbox功能,但是我在kendo-ui角度文档中找不到示例。在我们的例子中,我想使用SelectedRows [0] .TemplateId。 在此先感谢。

0 个答案:

没有答案