gpt4 book ai didi

mvvm - Kendo MVVM Grid - 如何响应行点击事件?

转载 作者:行者123 更新时间:2023-12-03 10:23:03 24 4
gpt4 key购买 nike

我有以下 Kendo MVVM 网格:

    <div>
<div id="systemsGrid" data-role="grid"
data-sortable="true"
data-scrollable="true"
data-editable="false"
data-selectable="true"
data-toolbar="['create', 'save', 'cancel']"
data-bind="source: systems"
data-auto-bind="true
data-columns="[
{ 'field': 'SystemName', 'width': 200 },
{ 'field': 'SystemKey', 'width': 200 },
{ 'command': [{name: 'destroy', text: 'Delete'}], 'width': 38 }
]">
</div>
</div>

单击给定行时,我想使用 SystemKey 查找其他数据并将其显示在另一个网格上。如何捕获此点击事件?我添加了这个:
$("#systemsGrid").on("click", gridClick);

但是,即使单击“添加新记录”按钮,这也会触发。仅响应单击网格行的正确方法是什么?

最佳答案

为什么不简单绑定(bind)change事件到您的gridClick ?

就像是:

<div>
<div id="systemsGrid" data-role="grid"
data-sortable="true"
data-scrollable="true"
data-editable="false"
data-selectable="true"
data-toolbar="['create', 'save', 'cancel']"
data-bind="source: systems, events: { change: gridClick }"
data-auto-bind="true"
data-columns="[
{ 'field': 'FirstName', 'width': 100 },
{ 'field': 'City', 'width': 100 },
{ 'command': [{name: 'destroy', text: 'Delete'}], 'width': 100 }
]">
</div>
</div>

我在哪里绑定(bind) gridClick使用 events: { change: gridClick }
你可以在这里看到它: http://jsfiddle.net/OnaBai/6XALD/2/

关于mvvm - Kendo MVVM Grid - 如何响应行点击事件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24657736/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com