数据表重绘或刷新表

时间:2013-12-28 17:04:01

标签: java javascript jquery ajax jsp

我有一个表是服务器端的字段。

<table class="table table-bordered table-hover" id="eStudent-data-table">
    <thead>
        <tr>
        <th>Name</th>
        <th>Age</th>
        <th>Gender</th>
        <th>Religion</th>
        <th>Knowledge Level</th>
        </tr>
    </thead>
    <tbody>
        <c:forEach var="studentInfo" items="${ studentInfo }">
        <c:if test="${ studentInfo.graduate eq false }">
        <tr>
            <td><a href="#" class="profiler">${ studentInfo.name }</a></td>
            <td>${ studentInfo.age }</td>
            <td>${ studentInfo.gender }</td>
            <td>${ studentInfo.religion }</td>
            <td>${ studentInfo.knowledgeLevel }</td>
        </tr>
        </c:if>
        </c:forEach>
    </tbody>
</table>

我编辑这些值并通过Ajax将其保存在数据库中。我接下来想要的是重绘或刷新表以反映我的更改。但我是使用DataTables的新手。我不知道该怎么办。我在服务器端使用java。到目前为止,我红色的样本仅为PHP。有没有办法使用java作为服务器端?还请提供一个清晰的样本。我对文档很困惑。请耐心等待。

更新

我正在使用bootstrap进行设计。 <td><a href="#" class="profiler">${ studentInfo.name }</a></td>将连续显示模态和数据。我正在使用x-editable来编辑模态中的字段。下面的代码段是我编辑字段的示例代码

$(this).editable({
    pk: studentName,       // sent to the server side
    name: id,              // sent to the server side
    url: '../admin/edit_studentInfo.do',
    success: function(response, newValue) {
            // No data call back yet.. reserving for redrawing the DataTables
        console.log('test');
    }
});

另一次更新:

为了澄清更多此代码<td><a href="#" class="profiler">${ studentInfo.name }</a></td>我正在使用Bootstrap Modal,其中包含我正在编辑的字段,这些字段将反映到与DataTables数据源相同的数据库中。这是显示模态的片段。

$('.profiler').on( 'click', function() {
    ... // some code to fill the field in the modal
    $modal.modal(); // show modal to the view
});

0 个答案:

没有答案
相关问题