【发布时间】:2013-10-20 08:26:18
【问题描述】:
我有一个带有选择扩展的 dgrid。
如何在不选中该框的情况下选择任何行。
我的意思是,只有直接点击才能勾选复选框。
【问题讨论】:
我有一个带有选择扩展的 dgrid。
如何在不选中该框的情况下选择任何行。
我的意思是,只有直接点击才能勾选复选框。
【问题讨论】:
您的问题描述中的措辞听起来与您的问题标题有些不同,但我认为您要问的是如何仅允许通过选择器列中的复选框选择行。您可以将Selection mixin 与selectionMode: 'none' 和使用selector 列插件的列结合使用。这是一个粗略的例子:
require([
'dojo/_base/declare',
'dgrid/Grid',
'dgrid/Selection',
'dgrid/selector'
], function (declare, Grid, Selection, selector) {
var SelectionGrid = declare([Grid, Selection]);
var grid = new SelectionGrid({
columns: {
selector: selector({ label: '' }),
// other columns here...
},
selectionMode: 'none'
});
// Place, startup the grid, and add data here...
});
您可以在 dgrid 的 test/selector.html 页面中查看此类示例。
【讨论】:
cellNavigation 设置为false 所做的,根据定义——它改变了Keyboard mixin 的行为,使其专注于行级别而不是单元级别。您可以类似地在行级别应用选择,只需混合 Selection 而不是 CellSelection(这通常更适合 selector 的情况)。