dongquelu1239 2016-12-09 07:04
浏览 44
已采纳

数据表:单击特定按钮时搜索特定字符串

My idea is when button1 is clicked to get input in textare and make search in Datatables.

I need help, hope for understanding.

Sample Button Layout

my code is this, but I dont get result. I got other ways but i dont want to refresh page:

<script src="js/ie/jquery.placeholder.js"></script>
<script>
  $(function() {
    $('input, textarea').placeholder();
  });
</script>

and to call it like this:

<p class="btn btn-primary" id="myInput" onclick="updateInput('button1')">button1</p>
  • 写回答

2条回答 默认 最新

  • douli2876 2016-12-09 08:43
    关注

    Since you have provided almost zero information in your question except for the fact that you want to search the datatable on the click of a button, this should work for you.

    var oTable = $("#myTable").DataTable();
    
    $("button1").on('click', function(event){
      var searchText = "button1"; //Specific text that you want to search
      oTable.search(searchText).draw();
    }
    

    Here's a fiddle

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 等差数列中的素数个数
  • ¥50 寻找一位有逆向游戏盾sdk 应用程序经验的技术
  • ¥15 请问有用MZmine处理 “Waters SYNAPT G2-Si QTOF质谱仪在MSE模式下采集的非靶向数据” 的分析教程吗
  • ¥50 opencv4nodejs 如何安装
  • ¥15 adb push异常 adb: error: 1409-byte write failed: Invalid argument
  • ¥15 nginx反向代理获取ip,java获取真实ip
  • ¥15 eda:门禁系统设计
  • ¥50 如何使用js去调用vscode-js-debugger的方法去调试网页
  • ¥15 376.1电表主站通信协议下发指令全被否认问题
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证