最近在研究bootstrap table的使用,过程中查询了许多资料,在给table做点击下拉详情时发现网上的资料大部分是基础应用的资料,只有很少的一部分关于这部分的资料,而且并不完全。这里记录一下昨天遇到的问题。
在数据绑定上用了$('#table').bootstrapTable({...})的方式,在参数中添加了
detailView:true,
detailFormatter:function(index, row){
var html = [];
$.each(row, function (key, value) {
html.push('<p><b>' + key + ':</b> ' + value + '</p>');
})
}
发现table上确实出现了可操作按钮
但是当点击展开按钮会报错404无法找到action[],也无法进入detailFormatter定义的方法中,遍寻无果,不得已改用另一种数据绑定的方式
<table id="table" data-mobile-responsive="true"
data-toggle="table" data-toolbar="#toolbar"
data-detail-view="true" data-pagination="true"
data-page-number="1" data-page-size="10" data-page-list="[10,20,30]"
data-click-to-select="true" data-show-columns="true"
data-side-pagination="server"
data-detail-formatter="detailFormatter"
data-url="./showOrderList">
<thead>
<tr>
<th data-field="id">ID</th>
<th data-field="co