剣道グリッドに新しいレコードを挿入することだけを有効にして、レコードの編集を無効にすることは可能ですか?
私ができる最善のことは、JavaScriptの「編集」ボタンをonDataBoundで削除することです。設定しようとしEditable(ed => ed.Enabled(false))
ましたが、実行時にエラーが発生します。
@(Html.Kendo().Grid(Model)
.Name("Grid" + guid)
.HtmlAttributes(new { style = "margin:20px" })
.Columns(columns =>
{
columns.Bound(p => p.Id).Hidden(true);
//a few more columns
columns.Command(command =>
{
command.Edit().Text(Resources.KendoEdit).UpdateText(Resources.KendoUpdateText).CancelText(Resources.KendoCancelText);
command.Destroy().Text(Resources.KendoDestroy);
}).Title(Resources.KendoCommands).Width(180);
})
.ToolBar(toolbar => toolbar.Create().Text(Resources.KendoToolbarCreate))
.Editable(editable => editable
//.Enabled(false)
.Mode(GridEditMode.InLine)
.DisplayDeleteConfirmation(false)
)
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
.Events(events => events.Sync("sync").Error("error"))
.Model(mod => mod
.Id(p => p.Id)
)
.Model(mod => mod
.Field(p => p.OldRoleId).Editable(false)
)
.Read(read => read.Action("ChangeRole_Read", "ChangeRole"))
.Create(update => update.Action("ChangeRole_Create", "ChangeRole"))
.Update(update => update.Action("ChangeRole_Update", "ChangeRole"))
.Destroy(update => update.Action("ChangeRole_Destroy", "ChangeRole"))
)
.Sortable()
.Filterable(filterable => filterable
.Extra(true)
.Operators(operators => operators
.ForString(str => str.Clear()
.StartsWith(Resources.KendoFilterStartsWith)
.IsEqualTo(Resources.KendoFilterIsEqualTo)
.IsNotEqualTo(Resources.KendoFilterIsNotEqualTo)
.Contains(Resources.KendoFilterContains)
.DoesNotContain(Resources.KendoFilterDoesNotContain)
.EndsWith(Resources.KendoFilterEndsWith)
)
)
.Messages(mess => mess
.Info(Resources.KendoFilterMsgInfo)
.And(Resources.KendoFilterMsgAnd)
.Or(Resources.KendoFilterMsgOr)
.Filter(Resources.KendoFilterMsgFilter)
.Clear(Resources.KendoFilterMsgClear)
)
)
.Scrollable()
.Pageable(pg => pg
.Refresh(true)
.Messages(ms => ms
.First(Resources.KendoPageableFirst)
.Last(Resources.KendoPageableLast)
.Next(Resources.KendoPageableNext)
.Previous(Resources.KendoPageablePrevious)
.Empty(Resources.KendoPageableEmpty)
.Display(Resources.KendoPageableDisplay)
)
)
.Events(ev => ev
.Edit("edit")
.Save("save")
.DataBound("dataBound")
)
)