Question

I am using the jquery data table. I need to select the rows using the ordinary click, ctrl+A and shift key selection. sample is given below, using javascript and store the rows id in any variable. how we do that? if the samples are code please suggestion here

This is a sample

Same need that javascript , datatable

Was it helpful?

Solution

Let me give you a higher level logic

  1. Create datatable with checkboxes. Make sure you generate id's for those checkboxes and corresponding rows.

  2. On check box click, you can find the id of the row easily. Keep saving them in an array as you keep clicking.

  3. If you want to select all at once, give a specific id for select all checkbox and on click of that checkbox, loop through your data table and grab all the rows and put them in an array.

  4. Once you have the logic for onClick, you can easily add javascript keyboard events.

I apologize for not putting some code together, it's lot of code to write but simple enough.

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