Kendo ui Kendo UI Grid MVC-设置单元模式时,为什么每行末尾都会出现编辑按钮?
我的代码如下所示:Kendo ui Kendo UI Grid MVC-设置单元模式时,为什么每行末尾都会出现编辑按钮?,kendo-ui,kendo-grid,Kendo Ui,Kendo Grid,我的代码如下所示: @(Html.Kendo().Grid<JeffreysOnline.Entities.Customer>() .Name("grid") .Columns(columns => { columns.Bound(p => p.LastName).Width(150); columns.Bound(p => p.FirstName).Width(125); columns.Bo
@(Html.Kendo().Grid<JeffreysOnline.Entities.Customer>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.LastName).Width(150);
columns.Bound(p => p.FirstName).Width(125);
columns.Bound(p => p.MiddleInitial).Width(75);
columns.Bound(p => p.Phone).Width(125);
columns.Bound(p => p.Address).Width(150);
columns.Bound(p => p.City).Width(100);
columns.Bound(p => p.State).Width(50);
columns.Bound(p => p.Zip).Width(125);
columns.Bound(p => p.TaxName).Width(125);
columns.Bound(p => p.TaxId).Width(125);
columns.Bound(p => p.BadChecks).Width(125);
columns.Bound(p => p.OtherRisk).Width(125);
columns.Bound(p => p.Interests).Width(125);
columns.Bound(p => p.BirthDate).Width(125);
columns.Bound(p => p.BouncedCheck).Width(125);
columns.Bound(p => p.PCNumber).Width(125);
columns.Bound(p => p.Comments).Width(125);
columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200);
})
.ToolBar(toolbar =>
{
toolbar.Create();
toolbar.Save();
toolbar.Excel();
})
.Editable(editable => editable.Mode(GridEditMode.InCell)) // In-cell editing instead of the whole row
.Pageable()
.Navigatable() // This allows the user to tab between columns in the grid.
.Sortable()
.Scrollable()
.Groupable()
.Excel(excel => excel
.FileName("Customers.xlsx")
.Filterable(true)
.AllPages(false)
.ProxyURL(Url.Action("ExcelExport", "Customer"))
)
.HtmlAttributes(new { style = "height:700px;" })
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true) // We want to perform batch operations
.PageSize(500) // Set the page size
.Events(events => events.Error("error_handler")) // Define a function that gets called on an error
.Model(model => model.Id(p => p.RowId)) // Define the PK
.Create(update => update.Action("Create", "Customer")) // The Create method in the controller
.Read(read => read.Action("Read", "Customer")) // The Read method in the controller
.Update(update => update.Action("Update", "Customer")) // The Update method in the controller
.Destroy(update => update.Action("Delete", "Customer")) // The Delete method in the controller
)
@(Html.Kendo().Grid())
.名称(“网格”)
.列(列=>
{
columns.Bound(p=>p.LastName).Width(150);
columns.Bound(p=>p.FirstName).Width(125);
columns.Bound(p=>p.initial).Width(75);
columns.Bound(p=>p.Phone).Width(125);
columns.Bound(p=>p.Address).Width(150);
columns.Bound(p=>p.City).Width(100);
columns.Bound(p=>p.State).Width(50);
columns.Bound(p=>p.Zip).Width(125);
columns.Bound(p=>p.TaxName).Width(125);
列.绑定(p=>p.TaxId).宽度(125);
columns.Bound(p=>p.BadChecks).Width(125);
列。绑定(p=>p.OtherRisk)。宽度(125);
columns.Bound(p=>p.Interests).Width(125);
列。绑定(p=>p.BirthDate)。宽度(125);
columns.Bound(p=>p.BouncedCheck).Width(125);
columns.Bound(p=>p.PCNumber).Width(125);
columns.Bound(p=>p.Comments).Width(125);
Command(Command=>{Command.Edit();Command.Destroy();}).Width(200);
})
.ToolBar(ToolBar=>
{
toolbar.Create();
toolbar.Save();
toolbar.Excel();
})
.Editable(Editable=>Editable.Mode(GridEditMode.InCell))//在单元格中编辑而不是整行
.Pageable()
.Navigatable()//这允许用户在网格中的列之间进行制表。
.Sortable()
.Scrollable()
.Groupable()
.Excel(Excel=>Excel
.FileName(“Customers.xlsx”)
.可过滤(真)
.所有页面(错误)
.ProxyURL(Url.Action(“ExcelExport”、“Customer”))
)
.HtmlAttributes(新的{style=“height:700px;”})
.DataSource(DataSource=>DataSource
.Ajax()
.Batch(true)//我们要执行批处理操作
.PageSize(500)//设置页面大小
.Events(Events=>Events.Error(“Error\u handler”)//定义一个在发生错误时调用的函数
.Model(Model=>Model.Id(p=>p.RowId))//定义PK
.Create(update=>update.Action(“Create”、“Customer”)//控制器中的Create方法
.Read(Read=>Read.Action(“Read”,“Customer”)//控制器中的Read方法
.Update(Update=>Update.Action(“更新”、“客户”)//控制器中的更新方法
.Destroy(update=>update.Action(“Delete”、“Customer”)//控制器中的Delete方法
)
当网格在页面上呈现时,最后一列中会出现一个编辑按钮:
当我设置了单元格编辑模式时,为什么会出现此编辑按钮?您是指
编辑按钮吗?您正在将其添加到您的代码中:
columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200);
删除命令.Edit();
语句,该按钮应消失