Javascript 引导表:展开未隐藏的行

Javascript 引导表:展开未隐藏的行,javascript,jquery,bootstrap-table,Javascript,Jquery,Bootstrap Table,我已经设置了过滤器,可以隐藏引导表中的某些行。我还实现了“expandAllRows”方法来显示所有细节视图;但是,此方法将扩展所有行,包括那些被我的过滤器隐藏的行 如何修改bootstrap-table.min.js以仅显示可见行的详细视图 我认为我需要修改bootstrap-table.min.js中的行,但不确定如何修改: ...{key:"expandAllRows",value:function(){for(var t=this.$body.find("&

我已经设置了过滤器,可以隐藏引导表中的某些行。我还实现了“expandAllRows”方法来显示所有细节视图;但是,此方法将扩展所有行,包括那些被我的过滤器隐藏的行

如何修改bootstrap-table.min.js以仅显示可见行的详细视图

我认为我需要修改bootstrap-table.min.js中的行,但不确定如何修改:

...{key:"expandAllRows",value:function(){for(var t=this.$body.find("> tr[data-index][data-has-detail-view]"),e=0;e<t.length;e++)this.expandRow(i.default(t[e[).data("index"))}...

与其修改引导函数,不如在筛选它们时通过重命名属性来绕过它们。像这样的

function filter(keyword) {
  // your current filter logic, which hides the rows that don't match
  // in this example, you have hidden them with the class 'hidden-row' 
  let hiddenRows=$("tr.hidden-row[data-has-detail-view='true']");
  hiddenRows.each( function() {
     $(this).attr({
        'data-has-detail-view-hidden': 'true'
      })
      .removeAttr('data-has-detail-view');
  })
}

function clearFilters() {
// your logic, then
      let hiddenRows=$("tr.hidden-row[data-has-detail-view-hidden='true']");
      hiddenRows.each( function() {
         $(this).attr({
            'data-has-detail-view': 'true'
          })
          .removeAttr('data-has-detail-view-hidden')
          .removeClass('hidden-row');
      })
 }

为什么需要修改引导功能?除了expandAllRows()之外,您还可以使用自己的函数。我如何使用bootstrap函数呢?说到javascript,我是个笨蛋。谢谢你现在能给我看看你的展开按钮的html吗?或者你在哪里调用onclick方法来展开?添加了JS函数,它利用bootstrap tables自定义按钮选项来创建按钮及其事件。效果很好。非常感谢。
function filter(keyword) {
  // your current filter logic, which hides the rows that don't match
  // in this example, you have hidden them with the class 'hidden-row' 
  let hiddenRows=$("tr.hidden-row[data-has-detail-view='true']");
  hiddenRows.each( function() {
     $(this).attr({
        'data-has-detail-view-hidden': 'true'
      })
      .removeAttr('data-has-detail-view');
  })
}

function clearFilters() {
// your logic, then
      let hiddenRows=$("tr.hidden-row[data-has-detail-view-hidden='true']");
      hiddenRows.each( function() {
         $(this).attr({
            'data-has-detail-view': 'true'
          })
          .removeAttr('data-has-detail-view-hidden')
          .removeClass('hidden-row');
      })
 }