angular-datatables icon indicating copy to clipboard operation
angular-datatables copied to clipboard

Question v0.4.3: how to select multiple rows without using the checkbox ?

Open nemcuon opened this issue 10 years ago • 3 comments

Dear all,

For version v0.4.3 I have the following question

I'd like to let user be able to select more than 1 row, and I don't want to use the checkboxes. What can I do ?

I've googled around and have only found the following ways

  1. A normal "on the row click" can work with only 1 row

.withOption('rowCallback', function (nRow, aData, iDisplayIndex, iDisplayIndexFull) { // Unbind first in order to avoid any duplicate handler (see https://github.com/l-lin/angular-datatables/issues/87) $('td', nRow).unbind('click'); $('td', nRow).bind('click', function () { $scope.$apply(function () { $scope.handleGelockteDocumentenClick(aData); }); }); $(nRow).on('click', function (e) { $(nRow).addClass('highlight'); }); return nRow; })

  1. The "multiple row selection" as http://l-lin.github.io/angular-datatables/#/rowSelect uses the checkboxes, which I don't want because of legacy reason.

Many thanks,

nemcuon avatar May 30 '16 04:05 nemcuon

I've found https://datatables.net/extensions/select/examples/api/select.html, whose behavior is exactly what I need, with Click, Ctrl, Shift: "Item selection can be performed by the end user in one of three different modes:

  • Operating system (os) style - where a single click will select a single item only, deselecting any others that were previously selected, a shift click will select a range of items and a ctrl / cmd click will add and remove items from the selection.
  • Single item select (single) - only a single item can be selected at any one time. Any previously selected items will be deselected.
  • Multi-item selection (multi) - item selection is toggled with a single click."

but I don't know how to use that jquery style together withy your angular style.

Can anyone help me ? Thanks

nemcuon avatar May 30 '16 13:05 nemcuon

It is done: just use .withOptions('select', true);

nemcuon avatar May 31 '16 07:05 nemcuon

How to achieve the row selection when serverSide is true ?

hrishikeshtt avatar Sep 25 '18 11:09 hrishikeshtt