Select multiple grid lines with Ctrl + Click?

Is it possible to select several grid lines with Ctrl + Click and then delete all selected lines with the button?

+4
source share
1 answer

You may have a hidden field on the page that is updated with each row identifier in some limited list. Using jQuery, you can easily add a click event for each row that will add an identifier to a hidden field on the client. After clicking a row of lines, the hidden field may look something like "3.65,245,111"

Here is some jQuery to get you started. This will assign a click event for each row of the table with the identifier "myTable":

$(document).ready(function() { $('#myTable tr').click(function() { //Insert your code to handle the click event and assign the row value to your hidden textbox }); }); 

The above will make it so that you can handle every time a row is clicked. You need to write some code and be creative to figure out how to get the id of the clicked string.

A separate “delete all lines” button will take a value in a hidden field, divide the line into each comma and then delete each line one by one.

There are many different ways to trick this cat, and above is a quick and easy way to complete the task.

+3
source

All Articles