1.遍历每一行
亮点: each(function(i)) ,i 就是每一行的序号,从0开始

点击(此处)折叠或打开

  1. <script type="text/javascript">
  2.         $(function(){
  3.             $("#table1 tr").each(function(i){
  4.                 $(this).click(function(){
  5.                     alert("你点击的是第"+(i+1)+"行");
  6.                 });
  7.             });
  8.         });
  9.     </script>
2.遍历被选中的多行的某一列数据

点击(此处)折叠或打开

  1. function getSelectedRow() {
  2.     var rowselect = [];
  3.     $table.find('tr.selected').each(function () {
  4.         var val = $(this).data('index');
  5.         var rowvalue = $table.bootstrapTable('getData')[val].case_id;
  6.         rowselect.push(rowvalue);
  7.     });
  8.     return rowselect;
  9. }

11-13 19:58