详情页显示的是关于这一条内容的更多数据
注释掉的地方是做过的尝试
呜呜呜求大佬
$('#table').bootstrapTable({
method: 'get',
striped: true,
pagination: true,
singleSelect:true,
dataType: 'json',
pageNumber: 1, //初始化加载第一页,默认第一页
pageSize: 10, //每页的记录行数
onClickRow:function(row, $element) {
// var row=$("#table").bootstrapTable('getSelections');
// var rowsid = row.serial;
// // var selectedRow = $('#table').bootstrapTable("getSelected");
// alert(rowsid);
// var row=$('#table').bootstrapTable('getSelections');
// $table.bootstrapTable('getSelections').
var row = $table.bootstrapTable('getRowByUniqueId', 1);
},
columns: [
{ checkbox: true },
{
field: 'serial',
title: '序列号'
}, {
//例如这是你的row
var data = [
{
'id': 0,
'name': 'Item 0',
'price': '$0'
},
{
'id': 1,
'name': 'Item 1',
'price': '$1'
},
{
'id': 2,
'name': 'Item 2',
'price': '$2'
},
{
'id': 3,
'name': 'Item 3',
'price': '$3'
},
]
onClickRow:function(row, $element) {
//这里的row参数就是点击某行获取的行对象,可以row.id,row.name,row.price等等这样获取行内的数据
alert(row.id)
//这里是跳转页面,把参数带到后面就行,如果有多个就用&把参数隔开就可以
window.location.href="index.html?id=" + row.id
}
就你注释的地方,写onClickRow: function (row),首先写一个 alert("ok");
看看事件是否执行
如果执行,onClickRow: function (row) { alert(row); }
看看能不能得到行,进而得到id
最后写上类似 window.location.href="你的地址?id=" + 你的id;
$('#table').bootstrapTable({
……
"createdRow" : function(row, data, dataIndex) {
// row表示当前行,data表示当前行数据 用bind绑定click事件,第二个是方法的数据参数,第三个是方法名
// 1表示 columns的第 2列(序号从0开始)
$(row.children[1]).bind("click", data.roleCode, me.showRoleDetail);
},
});