如何处理表行选择更改? [英] How to handle Table row selected changed?

查看:49
本文介绍了如何处理表行选择更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用Blazor处理表的行选择更改事件?我尝试处理@onchange以及@onselectionchange.该表的语法如下所示:

How to handle row selected changed event for a table using Blazor? I tried handling @onchange as well as @onselectionchange. The syntax for the table looks like this:

< table class ="table" @onchange ="@ this.SelectionChanged">

推荐答案

您的事件绑定不起作用,因为 table 元素不会发出 change 事件.

Your event binding doesn't work because the table element does not emit change events.

相反,您可以在表行中添加输入元素(例如复选框).然后,您可以通过将事件绑定添加到输入元素来处理行选择更改.

Instead, you could add an input element (for example a checkbox) inside your table rows. You can then handle row selection changes by adding your event binding to the input elements.

这篇文章中了解有关HTMLElement更改事件的更多信息.

这篇关于如何处理表行选择更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆