Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/448.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript aui数据表可排序选择行_Javascript_Liferay Aui_Alloy Ui - Fatal编程技术网

Javascript aui数据表可排序选择行

Javascript aui数据表可排序选择行,javascript,liferay-aui,alloy-ui,Javascript,Liferay Aui,Alloy Ui,我正在使用aui库创建一个可排序的数据表。我希望单元格是可选择的(通常是纯文本,没有javascript事件绑定) 将列定义为 var columns = [ { key: "col1", label: "Column 1", sortable: true }, { key: "col2", label: "Column 2", sortable: true },

我正在使用aui库创建一个可排序的数据表。我希望单元格是可选择的(通常是纯文本,没有javascript事件绑定)

列定义为

var columns = [
    {
        key: "col1",
        label: "Column 1",
        sortable: true
    },
    {
        key: "col2",
        label: "Column 2",
        sortable: true
    },
    ...
];
如果我使用类似

var myDatatable = new A.DataTable.Base({
    columnset : columns,
    recordset : data
});
我可以选择单个行,但没有排序

如果我使用

var myDatatable = new A.DataTable({
    columnset : columns,
    recordset : data
});
该表是可排序的,但我不能用普通的鼠标按住并拖动来选择数据

我错过了什么

我已经尝试添加以下插件

plugins: [{
    cfg: {
        type: "rows"
    },
    fn: A.Plugin.DataTableHighlight
},
{
    cfg: {
        selectRow: true,
        selectColumn: true
    },
    fn: A.Plugin.DataTableSelection
}]
但简单的选择却没有运气。aui文档仅供参考。请注意,基本示例执行我需要的减号排序,而实际示例需要双击单元格(允许编辑)才能选择/复制内容


请帮忙。谢谢

在呈现表之后,我通过清除mousedown和mouseup事件并重写
getEditor
函数成功地解决了这个问题,排序仍然有效

/* text is not selectable otherwise */
myDatatable.get("contentBox").purge(true, "mousedown");
myDatatable.get("contentBox").purge(true, "mouseup");
/* suppress getEditor */
A.DataTable.prototype.getEditor = function() {};