drt5813 2014-09-03 06:34
浏览 1054

如何通过单击按钮重置表单并刷新数据表?

I have a button with id="reset", So when the button is clicked I want to do two things:

  1. The form has to be reset.
  2. Refresh the datatable.


Js/jQuery:

$("#reset").click(function(){
    $("myform").reset();
    var oTable = $('#documentreport').dataTable();
    oTable.fnDraw();
}

This is what I have tried so far. Any help would be appreciated

  • 写回答

1条回答 默认 最新

  • doujiku1028 2014-09-03 06:54
    关注

    refresh database:

    Calling $('#table').dataTable().fnDestroy(); will clear the table of dataTable code and allow you to manipulate the table, and then call dataTable on it again.

    Reset form: http://jsfiddle.net/8zLLn/

      $('#reset').click(function(){
            $('#myform')[0].reset();
      });
    

    very well answered by shmuel613 and tadiou thank you both.

    评论

报告相同问题?

悬赏问题

  • ¥88 实在没有想法,需要个思路
  • ¥15 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件
  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)