ブートストラップv3を使用しています。私は絵のように効果を得ようとします。私はボタンを表示したいのですが、"Item Name"
をpopup
に表示します。しかし、私のボタンは表示されません。ブートストラップテーブル - 動的ボタンの行
問題は、私のテーブルの性質がダイナミックであることです(フォームJSON
) - これは困難です。
var $table = $('#table');
var mydata = [{
"id": 0,
"name": "test0",
"price": "$0"
},
{
"id": 1,
"name": "test1",
"price": "$1"
},
{
"id": 2,
"name": "test2",
"price": "$2"
}
];
$(function() {
$('#table').bootstrapTable({
data: mydata
});
});
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.10.1/bootstrap-table.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflarenter code heree.com/ajax/libs/bootstrap-table/1.10.1/bootstrap-table.min.js"></script>
</head>
<body>
<div class="container">
<table id="table" data-search="true">
<thead>
<tr>
<th data-field="id" data-sortable="true">Item ID</th>
<th data-field="name" data-sortable="true">Item Name</th>
<th data-field="price" data-sortable="true">Item Price</th>
<th>Show Name</th>
</tr>
</thead>
<tbody>
<tr></tr>
<tr></tr>
<tr></tr>
<tr>
<td>
<button type="button" class="btn btn-primary btn-sm">Small button</button>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
私はあなたの助けのために感謝するでしょう。このことができます
だから、あなたはアイテム名をクリックして開かれたポップアップ(モーダル)を持っていると思いますか? –
はい、ポップアップ。しかし、ボタンをクリックした後。クリックしてボタンを押してください1st show test0、click button 2st show test1など – user3794273
こんにちは、これはいくらか必要ですか? https://jsfiddle.net/tmyfssw2/。私はCSSを追加しなかった。コピーしてコピーしてください:P –