I am using jquery datatable for my project. It's working well when i have less columns. But when it goes above 18 columns,it refuses to apply sorting and colvis functionalities. My current code is as below.
<table id="testTable" class="display nowrap stripe row-border order-column" cellspacing="0" align="center">
<%
try {
String a="";
String acode = "N/A";
int atp1, id4;
query = "SELECT * FROM IETMS;";
stmt = conn.createStatement();
rs = stmt.executeQuery(query);
ResultSetMetaData rsmd=rs.getMetaData();
int columns = rsmd.getColumnCount();
if(rs.next()) {
%>
<thead>
<tr style="background-color: #3f91bd;color:white;">
<% for (i=1; i<=columns-2; i++) {%>
<th><%= rsmd.getColumnLabel(i) %></th>
<% } %>
</tr>
</thead>
<tfoot>
<tr class="header">
<% for (i=1; i<=columns-2; i++) {%>
<th><%= rsmd.getColumnLabel(i) %></th>
<% }%>
</tr>
</tfoot>
<%}%>
<tbody stye="border: 2px solid green;">
<% while(rs.next()){ %>
<tr class="clickable">
<%
for (i=1; i<=columns-2; i++) {
if(rs.getObject(i) == null)
{
a = "N/A";
} else
a=""+rs.getObject(i);
%>
<td height="15"><%=a%></td>
<% }%>
</tr>
<%}%>
</tbody>
<%
} catch (Exception ex) {
out.println(ex);
}
%>
</table>
I'd like to move the implementation to a new JSP page that fetches data using JSON, but I'm not really all that familiar with JSON. I've looked at many examples, but it seems like JSON has a fixed schema, and I want to dynamically display whatever data is returned. Is there a way to do this with JSON?