我使用的是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 ();