user1555190
user1555190

Reputation: 3243

Twitter Bootstrap dropdown in table row <td>

Im trying to get a drop down to appear in a table row, in a specific column, but it doesnt seem to be working.

Im using chrome, but i cant seem to get it to work, i have tried to follow many exmaples, but none seem to work.

<!DOCTYPE HTML>
<%@ page isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<html>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <script type="text/javascript" src="<%=request.getContextPath()%>/resources/js/bootstrap/bootstrap.js"></script>
      <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/resources/css/bootstrap/bootstrap.css">
   </head>
   <body style="overflow: hidden;">
      <div class="container" align="center">
         <h1 style="margin-top: 100px;">Admin Page</h1>
         <table class="table table-bordered">
            <thead>
               <tr>
                  <th>Id</th>
                  <th>Game</th>
                  <th>Bonus</th>
               </tr>
            </thead>
            <tbody>
               <tr>
                  <td>1</td>
                  <td>Treasure Island</td>
                  <td>
                     <div class="dropdown">
                        <a data-target="#" data-toggle="dropdown" class="dropdown-toggle" href="#">Dropdown menu here...
                        <b class="caret"></b>
                        </a>
                        <ul class="dropdown-menu">
                           <li><a href="/app/1">Item A</a></li>
                           <li><a href="/app/2">Item B</a></li>
                           <li><a href="/app/3">Item C</a></li>
                        </ul>
                     </div>
                  </td>
               </tr>
            </tbody>
         </table>
      </div>
   </body>
</html>     

Upvotes: 3

Views: 11706

Answers (1)

Tim
Tim

Reputation: 3043

Assuming you want that dropdown triggered by a button, you could do something like this...

<div class="btn-group">
    <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
        Action
        <span class="caret"></span>
    </a>
    <ul class="dropdown-menu">
        <!-- dropdown menu links -->
    </ul>
</div>

Upvotes: 4

Related Questions