如何选择 icefaces ace:datatable 中的所有可见行?

How can I selectall visible rows in an icefaces ace:datatable?

看起来 ace:datatable 组件没有 selectall/deselectall 功能...除非您直接按住 shift 键并单击 table。

我不想执行 ajax 提交和修改 RowStateMap,因为:

a) 我宁愿在表单提交之前不做任何提交 b) RowStateMap.setAllSelected() 选择 table 中的所有行而不考虑可见性。

有什么想法吗?

也许这会有所帮助。 icefaces 的 datatable.js 文件有一个方法:

ice.ace.DataTable.prototype.doMultiRowSelectionEvent = function (lastIndex, current)

我直接试过运行这个:

<h:commandButton value="Select All" 
    onclick="ice.ace.DataTable.prototype.doMultiRowSelectionEvent(0,
    ice.ace.jq('.ui-datatable-data').children().last()); return false;"/>                                

但这似乎没有用。

所以我创建了一个函数 "doSelectAllRows",它是 "doMultiRowSelectionEvent" 的副本,但有以下更改:

ice.ace.DataTable.prototype.doSelectAllRows = function () {

    var self = this,
        tbody = ice.ace.jq(this.jqId).find('.ui-datatable-data'),
        elemRange = tbody.children(),
        deselectedId, firstRowSelected;

    // Sync State //
    self.readSelections();