YiSha.Web\YiSha.Admin.Web\wwwroot\lib\bootstrap.treetable\1.0\bootstrap-treetable.js文件中替换注册行点击选中事件代码
javascript
// 注册行点击选中事件
var registerRowClickEvent = function () {
target.find("tbody").find("tr").unbind();
target.find("tbody").find("tr").click(function () {
target.rowClickHandler(this);
if (options.onNodeClick) {
//增加行点击事件
var row = {
haveChild: false//是否存在子节点
}
$.each($(this).find('td'), function (index, item) {
if (!$(item).attr("name")) {
row.data_Id = $(item).find("input[name='select_item']").val()//数据主键ID
}
else {
if ($(item).find(".treetable-expander.glyphicon.glyphicon-chevron-down").length > 0) {
console.log('each', index, item, $(item).attr("name"))
row.haveChild = true
}
row[$(item).attr("name")] = $(item).attr("title") || ""
}
})
options.onNodeClick(row)
}
});
}
调用时在组件options参数中加入
javascript
onNodeClick: function (row) {
console.log('onNodeClick', row)
},