2

I have a table powered by jQuery DataTables with checkbox in the first column to edit the row data. And I have a time column with duplicate values so I kept the row grouping on that time column.

Now I only need to show one checkbox for grouped row data. For the grouped time data I want to show only first checkbox to edit.

enter image description here

1
  • You should provide some code snippets, and try to be more specific what exactly is your problem.
    – Sojtin
    Feb 22, 2017 at 11:32

1 Answer 1

3

SOLUTION

Row grouping could be done with RowsGroup plugin for jQuery DataTables. Checkboxes could be implemented with Checkboxes plugin for jQuery DataTables.

I was able to combine the two using the code below.

var table = $('#example').DataTable({
   'ajax': 'https://api.myjson.com/bins/1us28',
   'rowsGroup': [0,3],
   'columnDefs': [
      {
         'targets': 0,
         'data': 3,
         'checkboxes': {
            'selectRow': false
         }
      }
   ]
});   

See this example for code and demonstration.

HIGHLIGHTS

  • Row selection is disabled with 'selectRow': false as it doesn't behave as expected with row grouping.
  • Checkboxes use data for the fourth column 'data': 3.

LINKS

4
  • Hi, Rowgrouping is working but i am getting sorting on the checkbox column .I tired to remove it but because of row grouping it is not working. Can you please help me on that.
    – dvv
    Mar 17, 2017 at 21:54
  • @VijayaSaladi, that's because RowsGroup plugin enforces sorting on grouped columns. Since you need to show 1 checkbox for grouped data, RowsGroup adds sorting arrow to the header with the checkbox. Mar 18, 2017 at 0:25
  • why that sorting on the grouping column is not working.As I specified I want to apply the sort on the time column in my datatable.But it not not working.
    – dvv
    Apr 19, 2017 at 6:24
  • @dw, inability to sort by grouped columns and the column containing checkboxes is the current limitation of both plug-ins. Apr 19, 2017 at 10:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.