Estoy usando DataTables y tengo una casilla de verificación. Al cambiar, activé una función. Quiero pasar dos variables a la función así:
{data: null, className: "center", render: function(data,type,row) { alert(data.sesId); if(data.checkedIn === "N"){ return ("<input type='checkbox' id=" + data.patId + " name='update' onchange='patientCheckInFunction(this," + data.sesId + ")' style='zoom: 2.0;'>"); }else{ return ("<input type='checkbox' id=" + data.patId + " name='update' onchange='patientCheckInFunction(this," + data.sesId + ")' style='zoom: 2.0;' checked>"); } }, },Esto me da un "Token inesperado ')'" en el registro de la consola.
No hay error si tengo:
return ("<input type='checkbox' id=" + data.patId + " name='update' onchange='patientCheckInFunction(this)' style='zoom: 2.0;'>");Sin embargo, quiero pasar ambas variables.
Prueba así:
return ("<input type='checkbox' id='"+ data.patId +"' name='update' onchange='patientCheckInFunction(\"" + this + "\",\"" + data.sesId +"\")' style='zoom: 2.0;'>");No estaba usando "nombre", así que terminé haciendo esto:
return ("<input type='checkbox' id=" + data.patId + " name=" + data.sesId + " onchange='patientCheckInFunction(this, this.name)' style='zoom: 2.0;'>");