Estoy trabajando para crear una tabla en asp.net MVC y tener un botón al final para agregar las filas. a continuación se muestra el código para agregar filas. En esta tabla, solo tenemos menús desplegables y 1 menú desplegable de selección múltiple para el que estoy usando los archivos js y css de selección múltiple de correa de arranque.
Para la primera fila, puedo seleccionar, pero para la segunda fila, la selección múltiple no funciona, como cuando se hace clic en seleccionar todo, no se selecciona o cuando se marca un valor, no se resalta.
Por favor, hágamelo saber si hay alguna pista.
función añadirFilas() {
var table = document.getElementById('totaltbl'); var rowCount = table.rows.length; if (rowCount == 1) { location.reload(); return false; } var cellCount = table.rows[0].cells.length; var row = table.insertRow(rowCount); for (var m = 0; m < rowCount; m++) { row.setAttribute("id", "col" + m); } for (var i = 0; i <cellCount -1; i++) { var cell = 'cell' + i; cell = row.insertCell(i); if (i == 1) { //This cell contains the multiselect dropdown. Copying the first cell as it is and changing the id of the multiselect dropdown var copycel = document.getElementById('col' + i).innerHTML; cell.innerHTML = copycel; var id= $('table td:eq(3) select').attr('id') cell.setattribute("id", "customertype" + i) var element = $('table tr #col' + i +' select') element.attr('id', 'customertype' + i); var rowid = row.id var Ids = rowid.replace(/\D/g, "") // each row as a customertype to differentiate that we create the id and add to the CustomerType Id $('#CustomerType' +Ids).multiselect(); $('#'+custid).multiselect({ includeSelectAllOption: true }); } else { var copycel = document.getElementById('col' + i).innerHTML; cell.innerHTML = copycel; } } }