I am using DataTables multi item selection and like to submit the selected rows to my form.
Of course, I could manually create an input element for each row in my table:
<input type="hidden" id="row_0" name="par" value="456" disabled="disabled" />
<input type="hidden" id="row_1" name="par" value="876" disabled="disabled" />
...
and then toggle the disabled attribute based on the row selection. Something like this:
for (let row of table.rows({ selected: true })) {
$(`#row_${row.index()}`).removeAttr("disabled");
}
But maybe there is an easier solution which requires less coding, I did not find any.