javascript - 显示一个弹出窗口,其中包含 html 表格中每一行的详细信息

标签 javascript jquery html twitter-bootstrap jsp

我有一个像这样的 html 表格:

<table id="mytable" class="table table-striped">
<tbody>
    <c:forEach items="${listeCollabDeRrh}" var="collab">
        <tr>
            <td>${collab.matricule }</td>
            <td>${collab.nom }</td>
            <td>${collab.prenom}</td>
            <td hidden="true">${collab.bu.getNomBU()}</td>
            <td hidden="true">${collab.contact}</td>
            <td hidden="true">${collab.dateEmbauche}</td>
            <td>
                <p data-placement="top" data-toggle="tooltip" title="Details">
                    <button class="btn btn-primary btn-xs" data-title="Details" data-toggle="modal" data-target="#Details">	<span class="glyphicon glyphicon-text-color"></span>
                    </button>
                </p>
            </td>
        </tr>
    </c:forEach>
</tbody>
</table>

如果我单击详细信息按钮,我将弹出一个包含行的所有详细信息的弹出窗口:

<div class="modal-body">
<table id="mytable" class="table table-bordred table-striped">
    <thead>
        <th>Matricule</th>
        <th>Nom</th>
        <th>Pronom</th>
        <th>BU</th>
        <th>Contact</th>
        <th>Date d'ambauche</th>
        <th>RRH</th>
    </thead>
    <tbody>
        <tr>
            <td>matricule of collab</td>
            <td>nom of collab</td>
            <td>prenom of collab</td>
            <td>bu of collab</td>
            <td>contact of collab</td>
            <td>dateEmbauche of collab</td>
        </tr>
    </tbody>
</table>

问题在于 HTML 表格和详细信息弹出窗口位于同一个 jsp 页面中。我认为我可以在服务器端通过表单使用 Controller 。

如何在按下某一行的详细信息按钮时显示详细信息弹出窗口?

最佳答案

另一种变体是使用 jQuery。只要用户单击按钮,就会从服务器读取信息。

http://api.jquery.com/jquery.ajax/

为此投入时间并制作更好、更快且数据低调的应用程序。 但如果你不能使用,Farhan 有很好的解决方案。

关于javascript - 显示一个弹出窗口,其中包含 html 表格中每一行的详细信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32307020/

相关文章:

javascript - 如何知道 window.opener 是否来 self 的网页?

javascript - 如何更改为 keyup

javascript - 将 Canvas 数据导出到 json

javascript - 带有 Font-Awesome 和表格的工具提示

javascript - 用另一个 div jQuery 的内容替换 Div 的内容

javascript - 函数未获取验证的第二部分

jquery - AdSense 与 AJAX

jquery - 当我尝试垂直居中时,Margin-top 和 Margin-bottom 不起作用

jquery - 如何在当前页面之外的菜单链接上创建鼠标悬停效果?

html - 通过标题标题的水平线停止工作