我正在使用 Kendo UI Grid。我想对其进行 InCell 编辑。InCell 编辑运行良好。一旦我单击“添加新记录”按钮,它就会显示第一列“名称”的文本框。
我的问题是,当我在“名称”字段中输入值后按 Tab 键时,它不会转移到第二个字段“描述”。并且 Tab 键顺序应该在那里工作。
下面是 Kendo Grid 的代码:-
@using Gts.GlaspacLX.Web.App_Start;
@using Gts.GlaspacLX.ListValues;
@using System.Collections;
@using Kendo.Mvc.UI
@*<script src="@Url.Content("~/Scripts/jquery-ui-1.8.18.min.js")"></script>*@
<script type="text/javascript" src="../../Scripts/js/Product/Category.js"></script>
<style>
.k-dirty { display:none; }
</style>
<fieldset>
<form>
<div id="divProduct" style="display: none;">
@(Html.Kendo().Grid<Gts.GlaspacLX.Web.ViewModel.ProductViewModel>()
.Name("ProductGrid")
.Columns(columns => {
columns.Bound(p => p.Name).Width(50);
columns.Bound(p => p.Description).Width(200);
columns.Command(command => { command.Destroy(); }).Width(75);
columns.Bound(p => p.ID).Hidden();
})
.ToolBar(commands => {
commands.Create();
commands.Save();
})
.Editable(editable => editable.Mode(GridEditMode.InCell))
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true)
.ServerOperation(false)
.Model(model => {
model.Id(p => p.ID);
})
.Read(read => read.Action("ProductEditingInline_Read", "Product"))
.Create(create => create.Action("ProductEditingInline_Create", "Product"))
.Update(update => update.Action("ProductEditingInline_Update", "Product"))
.Destroy(destroy => destroy.Action("ProductEditingInline_Destroy", "Product")
)
.Events(events => events.Change("onProductChange"))
// .Events(events => events.Error("error_handler"))
)
)
<input type="button" value="Cancel" onclick=" $('.k-button.k-button-icontext.k-grid-cancel-changes').click(); $('#productWindow').data('kendoWindow').close(); " />
<input type="button" value="Save" onclick=" SaveProductChanges(); " />
</div>
</form>
</fieldset>
}
谁能帮我解决这个问题吗?
最佳答案
您需要使用navigatable option网格的。以下是我构建的 jsfiddle 示例:Kendo Grid Example with keyboard navigation 。在 MVC 中,可通过在网格上调用 .Navigatable() 打开可导航选项(请参见下面的示例):
@(Html.Kendo().Grid<TestModel>()
.Name("TestGrid")
.Columns(columns =>
{
columns.Bind(c => c.DisabledString);
columns.Bind(c => c.Description);
columns.Bind(c => c.TestInvisibleDate);
columns.Bind(c => c.TestDate);
columns.Bind(c => c.AllExpressions);
})
.HtmlAttributes(new { style = "height:550px;" })
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Sortable()
.Scrollable(s => { s.Enabled(true); s.Virtual(true); })
.Pageable(p => p.Enabled(false))
.Mobile(MobileMode.Disabled)
.Navigatable()
.Resizable(s => s.Columns(true))
.Reorderable(c => c.Columns(true))
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true)
.PageSize(50)
.ServerOperation(false)
.Model(model =>
{
model.Id(e => e.UniqueId);
})
)
)
这有帮助吗?
关于asp.net-mvc-4 - Tab 键顺序在单元格编辑 Kendo UI 网格中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21279033/