Uncaught TypeError: Object [object Object] has no method 'fnStandingRedraw'

我只是一个虾纸丫 提交于 2019-12-12 00:30:07

问题


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

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

when I init the dataTable I add :

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

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();
                        }

here it give me error: Uncaught TypeError: Object [object Object] has no method 'fnStandingRedraw'

some suggestions?


回答1:


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

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.



来源:https://stackoverflow.com/questions/19551638/uncaught-typeerror-object-object-object-has-no-method-fnstandingredraw

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!