My problem is that I want to export the selected rows in csv format.
Do you know of a JavaScript function that would allow me to do this?
I attach parts of the code and screenshots that illustrate my request.
I initialize a table in my html page with this function :
function constructTableCustomers() {
var i;
// tableau datatable
var sHTML = "";
sHTML += '<table id="datatable" class="table table-striped table-bordered" style="width:100%">';
sHTML += "<thead>";
sHTML += "<tr>";
sHTML += '<th style="text-align:center;"><input type="checkbox" id="bulk_action_select_all" onclick="selectAllCustomers()"></th>';
sHTML += "<th>ID CLIENT </th>";
sHTML += "<th style='padding-right: 15px !important;'>EMAIL CLIENT</th>";
sHTML += "<th>ID PRODUIT</th>";
sHTML += "<th>NOM PRODUIT</th>";
sHTML += "<th>ATTRIBUT</th>";
sHTML += "<th>ID ATTRIBUT</th>";
sHTML += "<th>NOM</th>";
sHTML += "<th>PRENOM</th>";
sHTML += "<th>DATE DE CREATION</th>";
sHTML += "</tr>";
sHTML += "</thead>";
sHTML += "<tbody>";
// pour chaque ligne de résultat, construire la ligne dans datatable
for(i = 0; i < aOfCustomers.length; i++) {
sHTML += '<tr style="text-align:center;">';
sHTML += '<td>' + '<input type="checkbox" id="checkbox_' + i + '">' + '</td>';
sHTML += `<td><a href='/${path_admin}/index.php/sell/customers/${aOfCustomers[i]["id_customer"]}/view?_token=${tokenAdminProducts}' target="_blank">${aOfCustomers[i]["id_customer"]}</a></td>`;
sHTML += `<td><a href='/${path_admin}/index.php/sell/customers/${aOfCustomers[i]["id_customer"]}/view?_token=${tokenAdminProducts}' target="_blank">${aOfCustomers[i]["email"]}</a></td>`;
sHTML += `<td><a href='/${path_admin}/index.php/sell/catalog/products/${aOfCustomers[i]["id_product"]}?_token=${tokenAdminProducts}' target='_blank'>${aOfCustomers[i]["id_product"]}</a></td>`;
sHTML += "<td>" + aOfCustomers[i]["product_name"] + "</td>";
sHTML += "<td>" + aOfCustomers[i]["name"] + "</td>";
sHTML += "<td>" + aOfCustomers[i]["id_product_attribute"] + "</td>";
sHTML += "<td>" + aOfCustomers[i]["lastname"] + "</td>";
sHTML += "<td>" + aOfCustomers[i]["firstname"] + "</td>";
sHTML += "<td>" + aOfCustomers[i]["date_creation"] + "</td>";
sHTML += '</tr>';
}
sHTML += "</tbody>";
sHTML += "</table>";
$('#customer_mail_alert_stock_table').html(sHTML);
}
thanks in advance !