Pawan
Pawan

Reputation: 2218

tab order is not working in Cell editing Kendo UI Grid

I am using Kendo UI Grid.And i want to do InCell editing on it.The InCell editing is working well.And once i click on "Add New Record" button then it shows textbox for the first column "Name".

My problem is when i press tab after putting value on "Name" field then its not shifting into second field "Description".And the tab order should work there.

Below is the piece of code for 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>
}

Can anyone help me out on this ?

Upvotes: 3

Views: 5018

Answers (1)

Rick Mortensen
Rick Mortensen

Reputation: 343

You'll want to use the navigatable option of the grid. Following is a jsfiddle example I've built: Kendo Grid Example with keyboard navigation. In MVC the navigatable option is turned on by calling .Navigatable() on the grid (see example below):

@(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);
    })
    )
)

This help?

Upvotes: 3

Related Questions