1
테이블 및 관련 항목에 Spring MVC
및 DataTable with jQuery
을 사용하고 있습니다.Null/Empty 데이터를 반입 할 때 DataTable
데이터가 없을 때 다음과 같은 오류가 발생합니다.
DataTables warning (table id='results'): Requested unknown parameter '1' from the data source for row 0
인터넷에서 검색 한 결과 열의 수가 일치하지 않을 수 있습니다. 그러나 예, 때로는 데이터가 null/비어 있으므로 UI에 렌더링 할 항목이 없습니다. 이 경우 테이블을 보여주지 않습니다.
하지만이 오류는 항상 발생합니다. 난 그냥 DataTables를 시작하고 기본 동작 사용 :
<table border="1" style="font-size:12px;width: 868px; table-layout: fixed; word-wrap: break-word;border-collapse: collapse" id='results'>
<thead>
<tr>
<th>Batch Name</th>
<th>Batch User</th>
<th>Total URL Count</th>
<th>Submitted URL Count</th>
<th>Processed URL Count</th>
<th>Submission Time</th>
<th>Batch Status</th>
<th>Download Link</th>
</tr>
</thead>
<tbody id="orderbody">
<tr id="pattern" style="display:none" >
<td width="15%"><span id="ibatchName">Batch Name</span></td>
<td width="15%"><span id="ibatchUser">Batch User</span></td>
<td width="11%"><span id="iTotalUrlCount" >Total URL Count</span></td>
<td width="11%"><span id="iSubmittedURLCount" >Submitted URL Count</span></td>
<td width="11%"><span id="iProcessedURLCount">Processed URL Count</span></td>
<td width="11%"><span id="iSubmissionTime" >Submission Time</span></td>
<td width="11%"><span id="ibatchStatus" >Batch Status</span></td>
<td width="15%"><span id="iDownloadLink" >Download Link</span></td>
</tr>
<c:choose>
<c:when test="${ not empty batches}">
<c:forEach var='batchDetail' items='${batches}'>
<tr id="pattern0">
<td>${batchDetail.batchName}</td>
<td>${batchDetail.batchUser}</td>
<td>${batchDetail.totalUrlCount}</td>
<td>${batchDetail.submittedUrlCount}</td>
<td>${batchDetail.processedUrlCount}</td>
<td>${batchDetail.submissionTimeFormatted}</td>
<td>${batchDetail.batchStatus}</td>
<td>${batchDetail.downloadLink}</a></td>
</tr>
</c:forEach>
</c:when>
<c:otherwise>
<tr id="pattern0">
<td colspan="8"><span class="batch_not_found">You are not authorized to see any of the batches. </span></td>
</tr>
</c:otherwise>
</c:choose>
</tbody>
</table>
어떻게해야합니까 :
jq(document).ready(function(){
jq("#results").dataTable();
});
내 테이블 코드는 다음과 같이이다? 데이터를 가져 오지 않을 때이 경고를 비활성화하는 방법이 있습니까?
감사합니다.