Data Table Plugin Not Working
Data Table Plugin Not Working
welsonsugi
Posts: 1Questions: 1Answers: 0
Hi all,
I am using the Datatable plugin... I am trying to use the plugin in my code but it doesn't work. Actually raw table appears but no plugins seem to be working . please anyone help me. I m new to this one.
This is my code :
<script src="/pms/common/js/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8" src="jquery.dataTables.min.js"></script>
<link rel="stylesheet" type="text/css" href="jquery.dataTables.css">
<body>
<script>
$(document).ready( function () {
var table = $('#statusTable').DataTable(
{
"paging" : true,
"pagingType": "full_numbers",
"bSort" : true,
"bSortClasses": true
});
} );
</script>
<div>
<table id="statusTable" width="80%" align="center" >
<thead>
<tr>
<th > Name</th>
<th >Type</th>
<th >Segment</th>
<th >Role</th>
<th>Severity</th>
</tr>
</thead>
<%InvStatusViewHandler invViewHandler=new InvStatusViewHandler();
List<InvStatusView> invStatusLst=invViewHandler.fetchDataFrmMO();
for(int i=0;i<invStatusLst.size();i++)
{
InvStatusView invStatData=invStatusLst.get(i); %>
<tbody>
<tr>
<td ><%=invStatData.getName()%></td>
<td ><%=invStatData.getType()%></td>
<td ><%=invStatData.getParentName()%></td>
<td ><%=invStatData.getRole()%></td>
<%
if (invStatData.getSeverity().toString().equals(
"Critical")) {
%>
<td class='formLabel' style="text-align: left;" nowrap><img
src="/fm/images/burgandy.gif"><%=invStatData.getSeverity()%></td>
<%
} else if (invStatData.getSeverity().toString()
.equals("Major")) {
%>
<td class='formLabel' style="text-align: left;" nowrap>
<img src="/fm/images/red.gif"><%=invStatData.getSeverity()%></td>
<%
} else if (invStatData.getSeverity().toString()
.equals("Minor")) {
%>
<td class='formLabel' style="text-align: left;" nowrap>
<img src="/fm/images/yellow.gif"><%=invStatData.getSeverity()%></td>
<%
} else if (invStatData.getSeverity().toString()
.equals("Warning")) {
%>
<td class='formLabel' style="text-align: left;" nowrap>
<img src="/fm/images/cyan.gif"><%=invStatData.getSeverity()%></td>
<%
} else {
%>
<td class='formLabel' style="text-align: left;" nowrap><img
src="/fm/images/green.gif"><%=invStatData.getSeverity()%></td>
<%
}
%>
</tr>
<%
}
%>
</tbody>
</table>
</div>
</body>
</html>
This discussion has been closed.
Answers
It looks like you are creating one
tbody
for every row. More the -tbody
outside of your loop.If that doesn't work, please link to the page so it can be debugged.
Allan