Layui table binding row click event and method of obtaining row data

Here we first record the trap of a row click event.

After the initialization of the table is completed, use events to give the table (positioning the table requires placing a specified div in the HTML code for the table)

done: function(res, curr, count){
 $('#div').find('.layui-table-body').find("table" ).find("tbody").children("tr").on('click',function(){
  var id = JSON.stringify($('#div').find('.layui-table-body').find("table" ).find("tbody").find(".layui-table-hover").data('index'));
  var obj = res.data[id];  //这里都是表格的数据
  fun.openLayer(obj);
 })
}

Guess you like

Origin blog.csdn.net/weixin_52691965/article/details/125290417