首先你这表格应该是根据请求后端传回来的数据循环遍历出来的,然后在每个按钮上都绑定一个对应该条数据唯一的值,可以用每条数据对应的id
点击选择是弹出窗口吗?选择是做什么操作呢?
给个思路
表格是代码生成的情况下
就可以写代码让其绑定id
举个例子
$(document).ready(function () {
Get_VisaMeaurement();
});
function Get_VisaMeaurement() {
var data = {};
$.ajax({
url: "/VisaMeasurementRecord/GetVisaMeaurementInfo/",
data: data,
type: "POST",
success: function (data) {
var html = '<table class="table table-striped table-bordered table-hover" id="sample_1"><thead><tr><th>序号</th><th>合同名称</th><th>建设单位</th><th>合同金额(元)</th><th>签证备案编号</th><th>发起人</th><th>创建时间</th><th>流程状态</th><th><button onclick=window.location.href="/VisaMeasurementRecord/Create" class="btn green">新建申请</button></th></tr></thead><tbody>';
var id = "";
var M_ID = '@ViewData["mid"]';
for (var i = 0; i <data.length; i++) {
id = data[i].VMR_ID;
html += '<tr ><td>' + (i+1) +
'</td><td>' + data[i].Contract_name +
'</td><td>' + data[i].P_JSDW +
'</td><td>' + data[i].Contract_totalmoney +
'</td><td>' + data[i].VMR_Code +
'</td><td>' + data[i].CreateUserName +
'</td><td>' + data[i].CreateTime+
'</td><td>' + data[i].FlowStatus +
'</td><td><a class="btn btn-info btn-sm" onclick=window.location.href="/VisaMeasurementRecord/Details?id=' + id + '">详细</a><a class="btn btn-warning btn-sm" onclick=EditVMR("' + id + '")>修改</a><a class="btn btn-danger btn-sm" onclick=DelVMR("' + id + '")>删除</a><a class="btn btn-info btn-sm" onclick=Report("' + id + '","' + M_ID + '")>打印</a>' +
'</td></tr>';
}
html += '</tbody></table>';
html = html.replace(/null/g, "").replace(/undefined/g, "");
$("#visameasurement").empty();
$("#visameasurement").html(html);
Lond_TabPage("sample_1", {
count: 9, bsearch: [0, 8], bsort: [8], buttonTypes: [
{ extend: 'excel', className: 'btn green btn-outline ', exportOptions: { "columns": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] }, title: "签证计量备案数据" }
]
});
}
});
}
可以看下最后一行的td里面内容