Bootstrap数据表获取数据行

时间:2017-01-24 06:48:58

标签: javascript jquery twitter-bootstrap

我目前正在使用此SB Admin作为引导UI。

我搜索了我的一个问题,我找到了这个问题SO LINK。以下是我的代码。我尝试使用链接中的代码。但它不起作用。



var checkedRows = [];
    $('#dataTables-SalesMenu').on('check.bs.table', function (e, row) {
        debugger;
        checkedRows.push({ id: row.id, name: row.name });
        console.log(checkedRows);
    });

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="panel-body">
  <div class="col-sm-12">
    <table class="table table-striped table-bordered table-hover table-responsive nowrap dataTable no-footer" role="grid" style="width: 100%;" id="dataTables-SalesMenu" aria-describedby="dataTables-SalesMenu_info">
      <thead>
        <tr role="row">
          <th class="sorting" tabindex="0" aria-controls="dataTables-SalesMenu" rowspan="1" colspan="1" aria-label="Menu: activate to sort column ascending" style="width: 400px;">
            Name
          </th>
          <th class="sorting" tabindex="0" aria-controls="dataTables-SalesMenu" rowspan="1" colspan="1" aria-label="Menu: activate to sort column ascending" style="width: 180px;">
            Position
          </th>
          <th class="alignRight sorting_desc" tabindex="0" aria-controls="dataTables-SalesMenu" rowspan="1" colspan="1" aria-label="Price: activate to sort column ascending" style="width: 180px;">
            Party
          </th>
          <th class="alignCenter sorting_disabled" rowspan="1" colspan="1" aria-label="Add To Tray" style="width: 90px;">
            Click to Vote
          </th>
        </tr>
      </thead>
      <tbody>
        <tr role="row" class="odd">
          <td>
            Name
          </td>
          <td class="alignRight sorting_2">
            Position
          </td>
          <td class="alignRight sorting_2">
            Party
          </td>
          <td class=" alignCenter">
            <center>
              <label>
                <input type="checkbox" value="" />
              </label>
            </center>
          </td>
        </tr>
        <tr role="row" class="even" style="color: white; background-color: rgb(82, 136, 75);">
        </tr>
      </tbody>
    </table>
  </div>
  <button id="buttonId">Heheheheh</button>
</div>
&#13;
&#13;
&#13;

我尝试在我的项目中搜索.bs,但我的问题是经过一段时间搜索我的VS正在NOT RESPONDING

0 个答案:

没有答案