Checkbox Selection on Remote Ajax Data
Checkbox Selection on Remote Ajax Data

Looking at https://datatables.net/extensions/select/examples/initialisation/checkbox.html, I see this working with data from a static html file in your example.
When I use an ajax call with your SSP class, how do I set up the blank column where the checkboxes will be? Do I have to select any column in the database so as to send back a blank field? I'm sure there is a tidier way to achieve this.
Secondly, in my specific case, I need the checkbox to be the last of 11 columns.
Should the config thus be modified as follows:
columnDefs: [ {
orderable: false,
className: 'select-checkbox',
targets: 10
} ],
select: {
style: 'os',
selector: 'td:last-child'
},
This question has an accepted answers - jump to answer
Answers
Well, based on your jsfiddle, I've done:
{ "data":null, render:function(){return "<input type='checkbox'/>";}}.
So now I have the checkbox in the last column. Do I still need these configs above?
Some, I suspect you still do not want it to be orderable. You probably don't want it to select the row (or maybe you do) when the checkbox is checked.
Sorry, your example at https://datatables.net/extensions/select/examples/initialisation/checkbox.html doesn't create the checkbox with render. So I've removed mine and now it shows no checkbox. I need guidance as the column is just blank.
Have you loaded the Select Extension JS and CSS files that the example is apart of?
You need those then the class '.select-checkbox' will generate the checkboxes.
Kevin
Oops, sorry about that. Fixed, thanks. But now it selects only one row. I dont find anything in docs to make it multiple row selection with the tick box and I dont have 'single' anywhere in my config. Please help.
Spoke too soon: works with shift but I've switched to 'multi'.
Awesome library, awesome support!!!
Hi using the checkbox class to provide the checkbox functionality (obviously!) but when wanting to select the rows programatically using Select api, rows are selected by the checkbox does not update. (I do this by adding a Select All button in my render method and use search to filter and then select the rows)
Also the two methods combined seem to conflict. eg if rows are select from search and then user clicks the (unchecked) checkbox then the row gets deselected but the check mark appears. I presume that this might be because one class is working on the data and one is working on the UI?
Can you please show an example how to select the rows AND check the checkboxes programmatically (eg an external -to the table -button?)
Hi @peasonokay ,
There's a lot going on there. We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin