Kendo Checkbox切换True和False状态无法正常工作
我正在尝试获取它,因此当单击一个或多个复选框时,我可以获取一个按钮。如果单击一个或多个复选框,我希望切换函数可以工作,但是,当我选择一个复选框时,它将打开,然后在下一次选择期间关闭。我敢肯定,我也在这里添加了几个不必要的属性,但对此不太担心。任何帮助将不胜感激。
HTML:按钮
<button class="btn btn-primary"
*ngIf="switchCase" style="float:right"
>Save</button>
HTML:复选框列
<kendo-grid-column field="checkbox" editor="boolean">
<ng-template kendoGridCellTemplate let-dataItem id="flexSwitchCheckChecked"
>
<input type="checkbox" (click)="toggleButton(dataItem, 'checkbox'
[checked]="dataItem.checkbox"
[width]="40"
>
TS:按钮单击方法
public switchCase: boolean = false;
toggleButton() {
this.switchCase = !this.switchCase;
I'm trying to get it so when one or more checkbox is clicked, I'm able to get a button to appear. I would like the toggle function to work if one or more checkbox is clicked, but instead, it will turn on when I select one checkbox, then turn off during the next selection. I'm sure I've got a couple of unnecessary properties added into here as well, but not too concerned about that. Any help would be appreciated.
HTML: Button
<button class="btn btn-primary"
*ngIf="switchCase" style="float:right"
>Save</button>
HTML: Checkbox Column
<kendo-grid-column field="checkbox" editor="boolean">
<ng-template kendoGridCellTemplate let-dataItem id="flexSwitchCheckChecked"
>
<input type="checkbox" (click)="toggleButton(dataItem, 'checkbox'
[checked]="dataItem.checkbox"
[width]="40"
>
TS: Button click method
public switchCase: boolean = false;
toggleButton() {
this.switchCase = !this.switchCase;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将事件传递给您的函数,然后从打字稿类访问其值:
步骤1(通过$事件):
在 *ngfor标签级别添加索引var
step1(获取其值):
pass an event to your function then access its value from typescript class:
Step1(pass an $event):
on *ngFor tag level add an index var
Step1(get its value):