簡體   English   中英

如何訪問AlloyUI數據表中的選定行

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

我使用AlloyUI 3.0。 我使用上面的代碼:

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");
    }
);

如何獲取選定的行數據? 如何定義選擇事件,單擊,雙擊等?

找到了一個解決方案:var rowUID = DataTable.get('selection')。rows [0] .guid(); DataTable.getRecord(UID).toJSON();

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM