Foren

DataTable row selection i aui 3.0.x

Szászvári Péter, geändert vor 7 Jahren.

DataTable row selection i aui 3.0.x

New Member Beiträge: 2 Beitrittsdatum: 01.09.16 Neueste Beiträge
Hi Everyone,
I'm relatively new to Liferay. I try to create a DataTable with visible row selection. The user should be able to select a row, it should be marked as such, and the program should be able to read later the id of the selected row.
I need to do it without a selection column with checkboxes.
I have spent several hours on this, I have working version of the table with data, but was not able to find example of row selection.
I have found good example code for AUI v. 1.5 http://alloyui.com/versions/1.5.x/examples/datatable/real-world/ but it does not help me in 3.0.x

So please let me know how can I make visible row selection in v 3.0.x

Thank you
Folken Fanel, geändert vor 7 Jahren.

RE: DataTable row selection i aui 3.0.x

New Member Beiträge: 3 Beitrittsdatum: 08.09.16 Neueste Beiträge
If you find out, please share with us. I have the same question.
Folken Fanel, geändert vor 7 Jahren.

RE: DataTable row selection i aui 3.0.x

New Member Beiträge: 3 Beitrittsdatum: 08.09.16 Neueste Beiträge
Found a solution:
var rowUID = DataTable.get('selection').rows[0].guid();
DataTable.getRecord(uid).toJSON();
Szászvári Péter, geändert vor 7 Jahren.

RE: DataTable row selection i aui 3.0.x

New Member Beiträge: 2 Beitrittsdatum: 01.09.16 Neueste Beiträge
Folken Fanel:
Found a solution:
var rowUID = DataTable.get('selection').rows[0].guid();
DataTable.getRecord(uid).toJSON();


Thank you. This would solve the getting the selected row part. But my first concern was, how to make it visible. So how to put a highlight on the last selected row that stays there and changes when another row is selected. As far as I understand, the highlight module can be configured, but for mouse-over not for selection. I might be wrong on that. Anyway I don't even understand how to configure the highlight module at all.
thumbnail
Kyle Joseph Stiemann, geändert vor 7 Jahren.

RE: DataTable row selection i aui 3.0.x

Liferay Master Beiträge: 760 Beitrittsdatum: 14.01.13 Neueste Beiträge
Hi Szászvári,
I've answered this question on StackOverflow:

You need to use the DataTableHighlight module with type: 'rows' instead:

YUI().use('aui-datatable', 'aui-datatable-highlight',
function(Y) {

/* ...your code here... */

var dataTable = new Y.DataTable({
/* ...your code here... */
plugins: [{
cfg: {
type: 'rows'
},
fn: Y.Plugin.DataTableHighlight
}]

}).render('#myDataTable');
});

- Kyle