我有一个剑道网格,每行都包含一个数字文本框。
我想检测这些数字文本框的更改和旋转事件,但由于某种原因这些事件没有触发。
剑道网格代码,
@(Html.Kendo().Grid<ContactLenseViewModel>()
.Name("contactLensesGridOs")
.Columns(columns =>
{
columns.Bound(p => p.Id).Title("Id").Hidden();
columns.Bound(p => p.Description).Title("Description");
columns.Bound(p => p.CostPrice).Title("Cost Price");
columns.Bound(p => p.SellingPrice).Title("Selling Price");
//numeric increment
columns.Bound(p => p.ItemQuantity).ClientTemplate(Html.Kendo().NumericTextBox()
.Name("clItemQuantityOs_#=Id#")
.HtmlAttributes(new { value = "#=ItemQuantity #" })
.Min(0)
.Max(5)
.Step(1)
.Decimals(0)
.Events(e => e
.Change("change")
.Spin("spin")
)
.ToClientTemplate().ToHtmlString());
})
.ToolBar(toolbar =>
{
toolbar.Template(@<text>
<div class="toolbar">
<div class="row">
<div class="col-md-3">
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></span>
<input type="text" class="form-control" id='FieldFilterOs' placeholder="Search for...">
</div>
</div>
</div>
</div>
</text>);
})
.Events(e =>
{
e.DataBound("GridBound");
e.Change("Grid_OnRowSelect");
})
.Pageable()
.Sortable()
.Scrollable()
.HtmlAttributes(new { style = "height:400px;" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(5)
.Events(events => events.Error("error_handler"))
.Model(model => model.Id(p => p.Id))
.Read(read => read.Action("SearchData", "Cls").Data("searchInputsOs"))
)
)
使用的 Change 和 spin 事件是,
<script type="text/javascript">
$(document).ready(function () {
//....
});
function change() {
alert("Change :: " + this.value());
}
function spin() {
alert("Spin :: " + this.value());
}
</script>
如果我在剑道网格之外使用相同类型的数字文本框,它会按预期工作并在更改时触发旋转和更改事件(选择数字,输入数字)。
所以,我遇到的问题是 - 为什么当数字文本框位于网格内时不会触发更改、旋转事件?任何帮助都感激不尽。谢谢你。