YUI 列选择
我在使用 YUI 的数据表列选择功能时遇到问题。我已经尝试过,
myEndColDataTable.subscribe("theadCellClickEvent", myEndColDataTable.onEventSelectColumn);
和
myEndColDataTable.subscribe("cellClickEvent", function (oArgs) { this.selectColumn(this.getColumn(oArgs.target));
});
问题是,我以编程方式选择了一个初始列。我可以突出显示另一列,但它不会从最初选择的列中删除选择。
I'm having issues using YUI's DataTable Column Selection Functionality. I've tried,
myEndColDataTable.subscribe("theadCellClickEvent", myEndColDataTable.onEventSelectColumn);
and
myEndColDataTable.subscribe("cellClickEvent", function (oArgs) {
this.selectColumn(this.getColumn(oArgs.target));
});
The issue is, I have an initial column selected programmatically. I can highlight the other column, but it doesn't remove the selection from the initially-selected column.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你是对的——没有快速干净的解决方案。
YUI DataTable 目前(从 2.8 开始)缺少一个
unselectAllColmns
方法来匹配unselectAllRows
(由onEventSelectRow
调用)。还值得注意的是,
onEventSelectColumn
选择列标题,因此unselectAllCells
将不起作用。您可以像这样实现自己的
unselectAllColumns()
函数:这比使用
getSelectedColumns()
的效率稍高,因为您不需要构建仅包含选定内容的中间数组columns(查看源代码 getSelectedColumns 调用 getColumnSet 并像上面一样遍历数组)。You are correct - there is no quick clean solution.
YUI DataTable currently (as of 2.8) lacks an
unselectAllColmns
method to matchunselectAllRows
(which is called byonEventSelectRow
).It is also worth noting that
onEventSelectColumn
selects the column header, sounselectAllCells
will not work.You could implement your own
unselectAllColumns()
function like this:This will be marginally more efficient than using
getSelectedColumns()
because you will not need to build an intermediate array of only selected columns (looking at the source getSelectedColumns calls getColumnSet and walks the array just as above).我想我可以做到这一点,但它并不优雅。必须有更好的方法。
I guess I can do this, but its not elegant. There has to be a better way.