未捕获的TypeError:对象[object Object]没有方法'fnStandingRedraw' [英] Uncaught TypeError: Object [object Object] has no method 'fnStandingRedraw'

查看:112
本文介绍了未捕获的TypeError:对象[object Object]没有方法'fnStandingRedraw'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的数据表只有几行,我想在表中添加新行:

I have a datatable with few rows, I want to add new row in table :

  var oTable = $('#StudentsTable').dataTable();
  Table2.fnStandingRedraw();

当我初始化dataTable时添加:

when I init the dataTable I add :

            "bProcessing": true,
            "bServerSide": true,
            "bDestroy": true,
            "fnFilter": true,
            'bLengthChange': true,
            'bPaginate': true,
            'bStandingRedraw': true,

ajax提交后,我要重新刷新表:

after ajax submit I want to redrow the table:

submitHandler: function(form) {
            var $modal = $('#ajax-modal');
            $modal.modal('loading');
            $(form).ajaxSubmit({
                dataType: 'json',
                success: function(result) {
                    if (result.Success) {
                        if (result.Data.Action == "add") {
                            var oTable2 = $('#StudentsTable').dataTable();
/*=>here is Call redraw */  oTable2.fnStandingRedraw();
                        }

在这里给我错误: 未捕获的TypeError:对象[object Object]没有方法'fnStandingRedraw'

一些建议?

推荐答案

您忘记包含 fnStandingRedraw 插件.确保将其添加到数据表的脚本文件之后.

You forgot to include the fnStandingRedraw plugin. Make sure to add it right after the Datatables' script file.

将代码段复制并粘贴到脚本顶部也可以,尽管将其放在单独的文件中可能会更有组织性和可重用性.或者,您也可以在未压缩的Datatables源文件的末尾连接此代码段,并对其进行最小化,因此,当包含Datatables脚本时,该代码段将始终可用.

Copying and pasting the snippet on top of your script would work too, though putting it on a separate file may prove to be more organized and re-usable. Or you can also concatenate this snippet at the end of the uncompressed Datatables source file and minify it altogether, so it will always be available when the Datatables script is included.

这篇关于未捕获的TypeError:对象[object Object]没有方法'fnStandingRedraw'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆