当焦点在单元格上时,有没有办法在Kendo Grid内的单元格中突出显示(选择所有文本)?当我选中或单击列时,我希望该单元格中的文本自动突出显示。提前感谢您的帮助。
我有以下代码:
@(Html.Kendo().Grid<ExerciseBreakdownViewModel>()
.Name(string.Format("Grid"))
.Columns(columns =>
{
columns.Bound(p => p.Id).Visible(false);
columns.Bound(p => p.PersonnelName).Width(120);
columns.Bound(p => p.NumberOfTeams).Width(120);
columns.Bound(p => p.TeamMembers).Width(110);
columns.Bound(p => p.Vehicles).Width(80);
columns.Bound(p => p.Brief).Format("{0:HH:mm}").EditorTemplateName("BriefTimePicker").Width(80);
columns.Bound(p => p.KickOff).Format("{0:HH:mm}").EditorTemplateName("KickoffTimePicker").Width(80);
columns.Bound(p => p.Debrief).Format("{0:HH:mm}").EditorTemplateName("DebriefTimePicker").Width(80);
})
.Editable(editable => editable.Mode(GridEditMode.InCell))
.HtmlAttributes(new { style = "height:400px;" })
.Navigatable()
.Scrollable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Events(events => events.Error("error_handler"))
.Model(model =>
{
model.Id(p => p.Id);
model.Field(p => p.PersonnelName).Editable(false);
model.Field(p => p.NumberOfTeams);
model.Field(p => p.TeamMembers);
model.Field(p => p.Vehicles);
model.Field(p => p.Brief);
model.Field(p => p.KickOff);
model.Field(p => p.Debrief);
})
.Read("Personnel_Read", "Schedule", Model)
)
)
答案 0 :(得分:6)
向网格添加编辑事件。
.Events(x => x.Edit("edit"))
function edit(e) {
var input = e.container.find("input");
input.select();
}