Skip to content
Advertisement

How to highlight and select multiple rows?

I would like to be able to perform similar operation to Excel where users can highlight and select multiple rows:

[Selected Excel rows are highlighted and the entire highlighted area has a green border.]

Here is an example where a user can click on the row and the row gets selected. But I want the green outline similar to Excel to be applied to my Bootstrap table. Ideally, there would be an option where to change the cursor to be able to highlight and select rows.

JavaScript
JavaScript
JavaScript

Advertisement

Answer

You would have to listen to the dragstart and dragend events on the <table>.

You can capture the cell index at the beginning and the end of dragging, calculate the delta, set the range selections, and finally display the selection.

JavaScript
JavaScript
JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement