mercredi 24 décembre 2014

Creating dynamic table with "dropdown multiselect checkbox" (jquery)

I am populating a dynamic table in my jsp page. I want to have one column as "dropdown multiselect checkbox" . To create "dropdown multiselect checkbox" i am using (jquery+bootstrap).But only first row is getting created with multiselectCheckbox, other rows are coming as normal select option.


Here is the code :-



<html><head>
<script>
<link rel="stylesheet" href="css/bootstrap.min.css">
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<link rel="stylesheet" href="css/bootstrap-multiselect.css"
type="text/css">
<script type="text/javascript" src="js/bootstrap-multiselect.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#myselect").multiselect({
includeSelectAllOption: true
});

});

</script>
</head>
<body>
<Table name="test" border="1">
<TR bgcolor="#33FFFF">
<td>ManagementIPAddress</td>
<td>Application name</td>
</TR>
<c:forEach var="resultMap" items="${requestScope.snmpGetResultsMap}">
<TR>
<TD><c:out value="${resultMap.key}" /></TD>
<TD><select id="myselect" multiple="multiple">
<option value="checkbox-1">checkbox-1</option>
<option value="checkbox-2">checkbox-2</option>
<option value="checkbox-3">checkbox-3</option>
<option value="checkbox-4">checkbox-4</option>
<option value="checkbox-5">checkbox-5</option>
<option value="checkbox-6">checkbox-6</option>
</select><br />
<br /></TD>
</TR>
</c:forEach>
</Table>
</body></head></html>


I know its happening because select id should be unique for each row , but now sure how to resolve it.





Aucun commentaire:

Enregistrer un commentaire