Question

I have a table parsed to Mootools HtmlTable class. using:

var table = new HtmlTable($('htmlTableElement'), {
 sortable: true,
 parsers: ['string','number','numberLax','floatLax'],
 selectable: true,
 allowMultiSelect: true,
 shiftForMultiSelect: false,
 classRowSelected: 'selectedRow'
});
table.sort(1);

http://jsfiddle.net/LMQ75/

What I want to do is, to select different rows by clicking on them. It's working pretty fine for one row and also using the Shift -key you can also select more than one row in an order. But how is it possible not to deselect the selected rows when clicking on another row? So that I can select e.g. two rows that are not connected?

I also figured out, that a row can be selected by clicking on it, but not deselected. Can I change this behaviour that first click selects a row and second click deselects a row?

Was it helpful?

Solution

I'm surprised of myself, I found a simple and easy solution, just adding this lines of code below table initialization:

$('htmlTableElement').getElements('tbody tr').addEvent('click',function(e){
 e.stopPropagation();
 table.toggleRow(this);
});

http://jsfiddle.net/LMQ75/2/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top