Javascript使用自定义按钮手动打开Kendo UI网格编辑器
Javascript Open Kendo UI Grid Editor Manually with Custom Button
有没有办法强制打开Kendo UI Grid使用的编辑器??我所说的强制打开是指我有一个网格,它可以添加、创建和删除行,但这是在我初始化Kendo网格时使用内置按钮完成的。
有没有一种方法或函数可以让我调用它来打开编辑器,这样我就可以把它附加到我定制的按钮上??
这是我创建网格的代码。(请注意,我删除了编辑,因为我不想单行编辑)
$("#userTable").kendoGrid({
dataSource:{
data: this.myCollection,
schema: {
model:{
fields:{
UserId: {type: "number"},
Firstname: {type: "string"},
Surname: {type: "string"},
Team: {type: "string"}
}
}
},
pageSize: 5
},
change: this.OnChange,
selectable: "multiple",
pageable: true,
editable: "popup",
toolbar: ["create"],
messages:{
commands:{
create: "Create"
}
},
columns:[
{field: "UserId", title: "User Id"},
{field: "Firstname", title: "Firstname"},
{field: "Surname", title: "Surname"},
{field: "Team", title: "Team"}
});
如有任何帮助或建议,我们将不胜感激。
谢谢,
使用Custom命令和editRow方法
...
command: { text: "Edit", click: customEdit }
...
function customEdit(e) {
e.preventDefault();
this.editRow($(e.currentTarget).closest("tr"));
}
演示
$("#btn").on("click", function() {
var grid = $("#userTable").data("kendoGrid");
grid.editRow(grid.select()); })
上面将允许您以编程方式编辑选定的网格行
相关文章:
- 使用导航属性创建Kendo UI网格模型的问题
- 在编辑内联模式下禁用Kendo Ui网格按钮
- Typescript Kendo UI网格列类型错误
- Kendo UI网格:数据源刷新后,我丢失了分页
- Kendo UI网格复选框列字段未定义
- 寻找使用Javascript从Kendo UI时间选择器中减去时间的更好替代方案
- Kendo UI Multiselect+ServerFiltering+带初始值的ServerPaging
- Kendo UI网格自定义编辑按钮
- 如何使用jQuery在模板kendo UI中获取元素类
- Kendo Ui CSS和JS文件要求
- Kendo UI网格有条件可编辑的单元格
- 在Kendo UI中将网格pageSize设置为变量
- Javascript使用自定义按钮手动打开Kendo UI网格编辑器
- Kendo UI层次结构DataSource架构不工作
- 如何在webdriver/java/kendo-ui中自动执行鼠标悬停操作
- Kendo UI数据源使用javascript对象设置
- AngularJs的Kendo UI:当用户在网格中选择行时,如何在文本框字段上绑定数据
- 在Javascript中创建自定义的可重用控件(Kendo UI)
- Kendo UI树视图中的延迟加载(带缓存)
- 淘汰JS与Kendo UI网格忘记用户'的选择