如何修复网格视图

时间:2019-04-02 14:54:48

标签: asp.net-mvc-4 kendo-ui kendo-grid kendo-asp.net-mvc

我正在kendo Grid上实现批量编辑功能。我已经创建了剑道网格。毕竟,我的问题是当我尝试内联编辑时,整个单元格都变成了html单元格。我的代码有什么问题。 视图

@(Html.Kendo().Grid<webkendo.Models.ProductViewModel>()
            .Name("grid")
            .Columns(columns =>
            {
                columns.Bound(product => product.ProductID).Width(50);
                columns.Bound(product => product.ProductName);
                columns.Bound(product => product.UnitsInStock).Width(50);
                columns.Command(commands =>
                {
                    commands.Destroy(); // The "destroy" command removes data items.
                }).Title("Commands").Width(200);
            })
            .ToolBar(toolbar =>
            {
                toolbar.Create(); // The "create" command adds new data items.
                toolbar.Save(); // The "save" command saves the changed data items.
            })
            .Editable(editable => editable.Mode(GridEditMode.InCell)) // Use in-cell editing mode.
            .DataSource(dataSource =>
                dataSource.Ajax()
                .Batch(true) // Enable batch updates.
                .Model(model =>
                {
                    model.Id(product => product.ProductID); // Specify the property which is the unique identifier of the model.
                    model.Field(product => product.ProductID).Editable(false); // Make the ProductID property not editable.
                })
                .Create(create => create.Action("Products_Create", "Home")) // Action method invoked when the user saves a new data item.
                .Read(read => read.Action("Products_Read", "Home"))  // Action method invoked when the grid needs data.
                .Update(update => update.Action("Products_Update", "Home"))  // Action method invoked when the user saves an updated data item.
                .Destroy(destroy => destroy.Action("Products_Destroy", "Home")) // Action method invoked when the user removes a data item.
            )
            .Pageable()
)

加载  enter image description here

当我尝试内联编辑时 enter image description here

它是怎么发生的?

0 个答案:

没有答案