简体   繁体   English

如何访问AlloyUI数据表中的选定行

[英]How to access selected row in a AlloyUI Data Table

Im using AlloyUI 3.0. 我使用AlloyUI 3.0。 I used the code above: 我使用上面的代码:

YUI().use(
    'aui-datatable',
    function(Y) {
        var columns = [
            {label: 'ID', key: 'id'},
            {label: 'Project Name', key: 'name'},
            {label: 'Created At', key: 'created_at'}
        ],
        data = [];

        var myDataTable = new Y.DataTable({
            plugins: [
                {
                    cfg: {
                    selectRow: true
                },
                fn: Y.Plugin.DataTableSelection
                },
                {
                cfg: {
                    highlightRange: false,
                    type: 'rows'
                },
                fn: Y.Plugin.DataTableHighlight
                }
            ],
            columns: columns,
            data: data
        })
        .render("#myDataTable");
    }
);

How to get the selected row data? 如何获取选定的行数据? How to define the selection event, click, double click, etc? 如何定义选择事件,单击,双击等?

Found a solution: var rowUID = DataTable.get('selection').rows[0].guid(); 找到了一个解决方案:var rowUID = DataTable.get('selection')。rows [0] .guid(); DataTable.getRecord(uid).toJSON(); DataTable.getRecord(UID).toJSON();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM