Keeping a single row selected, even after multiple clicks?
Keeping a single row selected, even after multiple clicks?
faintedremix009
Posts: 2Questions: 1Answers: 0
I am currently working on a datatable with these parameters.
var sampleTable= $('#sampleTable').DataTable({
bFilter: false,
bInfo: false,
deferRender: true,
ajax: {
url: someURL
},
columns: [
{data: "field1"},
{data: "field2"},
{data: "field3"}
],
rowId: 'field1',
select: 'single',
paging: false
});
Is there a way to keep a row selected if the end user has clicked on the particular row multiple times?
Also, is there a way to check if that row was previously selected on click?
For example:
$('#sampleTable tbody').on('click', 'tr', function() {
var rowData = sampleTable.row( this ).data();
// If the previous state of this row was selected... //
var url = "someGeneratedURL";
$.getJSON(url, function(data) {
doSomething();
});
});
Notes: This sampleTable is dynamic and is calling sampleTable.ajax.reload() on a set interval.
This discussion has been closed.
Answers
I have a work around for question 1.
This allows the sampleTable to keep a row selected despite multiple clicks. Happy coding!
thanks faintedremix009!