【问题标题】:Disable sorting of a column when a button is clicked单击按钮时禁用列排序
【发布时间】:2015-08-24 18:08:47
【问题描述】:

在我的 boostrap 表的一列的标题中,有一个显示模式帮助的按钮。 问题是该列是可排序的:然后,当我单击按钮时,排序和帮助显示都会发生。 如何禁用按钮中而不是列文本中的排序操作?

提前致谢!!

【问题讨论】:

  • 需要在按钮的点击事件上添加自己的代码。使用event.stopPropagation() 防止列的点击事件,之后,您需要使用$("your_modal_selector").modal('show'); 显示模式

标签: javascript twitter-bootstrap bootstrap-table


【解决方案1】:

我找到了问题的答案:

$( "#helpButton_id" ).click(function( event ) {
      // stopPropagation prevents the further sorting to happen
      event.stopPropagation();
      // show the modal programatically
      $('#Modal_id').modal('show');
    });

问候

【讨论】:

    【解决方案2】:

    此解决方案的问题在于,最初未显示的列(在网页代码中有data-visible="false")在显示时没有此行为。

    此外,帮助按钮显示在列选择器中,这是不可取的。

    【讨论】:

      猜你喜欢
      • 2012-04-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多