【问题标题】:kendo ui grid batch editing, set focus剑道ui网格批量编辑,设置焦点
【发布时间】:2014-06-22 18:37:10
【问题描述】:

我正在研究剑道 ui 网格。默认情况下,网格不可编辑。
工具栏中有一个“编辑”按钮。当用户点击它时,网格应该可以像this一样在批处理模式下编辑。

完成这项工作的唯一解决方案是删除并重新创建具有新属性的网格/数据源(可编辑:true 等)。

这按预期工作。现在我想将焦点设置在第一行/单元格上,以便用户可以看到网格现在是可编辑的(在下面的示例中,行变为输入字段)。

对此有何建议?

这是一个fiddle

 $('.k-grid-edit').on('click', function (e) {
     e.preventDefault();

     // remove old grid
     $('#grid').html('');

     // recreate grid with edit: true and new datasource
     $('#grid').kendoGrid({
         dataSource: dataSourceInEdit,
         editable: true,
         columns: [{
             field: 'TableId',
             title: 'Id',
             width: 50
         }, {
             field: 'Area',
             title: 'Area'
         }, {
             field: 'Table',
             title: 'Table',
             width: 60
         }, {
             command: 'destroy',
             title: ' ',
             width: 100
         }]
    }).data("kendoGrid");

}); // end edit

【问题讨论】:

  • 你能为你的问题创建一个小提琴吗?您提供的链接中的网格具有不同的行为!
  • @VivekParekh 有一个

标签: javascript jquery kendo-grid


【解决方案1】:

好的,我明白了:
这两行使它发生:

var grid = $("#rt_tableGrid").data("kendoGrid");
grid.editRow($("#rt_tableGrid tr:eq(1)"));

当然只在我的本地脚本上,在小提琴中我无法让它工作。

虽然在文档中是这样写的:需要“内联”或“弹出”
文档here

【讨论】:

  • 我需要将焦点设置在所选行中的特定单元格上吗?我怎样才能做到这一点?你能帮忙吗?
  • 这不起作用吗?对我来说,它选择一个特定的单元格 grid.editRow($('#rtGridEdit tr:eq(' + index + ')'));
  • 无法使用您的代码,您的意思是我必须手动指定索引吗?
  • 1=firstCell, 2=secondCell, ... 你到底是什么意思?
  • 啊,好吧,你说得对。你见过这个吗? stackoverflow.com/questions/11851071/…
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-06-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多