【问题标题】:Bootgrid select row when checkbox is clicked单击复选框时引导网格选择行
【发布时间】:2016-03-23 14:13:45
【问题描述】:

我正在使用 Bootgrid 在表格中显示数据:http://www.jquery-bootgrid.com/

当我将rowSelect 设置为true 时,选中复选框时无法选择行:

我创建了一个 JSFiddle:https://jsfiddle.net/n2jqjtep/1/

<table id="employeeList" class="table table-bordered">
  <thead>
    <tr>
      <th data-column-id="iEmployeeId" data-type="numeric" data-visible="false" data-identifier="true">Id</th>
      <th data-column-id="sName">Name</th>
      <th data-column-id="sAddress">Address</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>1</td>
      <td>dsa</td>
      <td>asd</td>
    </tr>
    <tr>
      <td>2</td>
      <td>sss</td>
      <td>assd</td>
    </tr>
  </tbody>
</table>

这是 JavaScript:

    var dt = $('#employeeList').bootgrid({
      selection: true,
      rowSelect: true,
      converters: {},
    });

我想在复选框被选中时选择行。

【问题讨论】:

  • 它看起来像是某种 bootgrid 错误,因为然后您将 multiSelect: true 添加到选项中它可以正常工作。

标签: jquery jquery-bootgrid


【解决方案1】:

你必须使用:

var dt = $('#employeeList').bootgrid({
      selection: true,
      rowSelect: true,
      converters: {},
    }).on("selected.rs.jquery.bootgrid", function(e, rows) {
 
    alert("Its Working");
}));

这里有几个例子: http://www.jquery-bootgrid.com/examples

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-28
    • 2022-07-08
    • 1970-01-01
    • 2017-03-24
    • 2013-08-20
    • 2011-09-21
    相关资源
    最近更新 更多