fnDestroy()+无效的参数行200 datatables.min.js + IE + JQUERY

时间:2015-11-25 10:11:26

标签: javascript jquery datatables

我正在使用JQuery数据表。单击按钮时,我必须重新初始化数据表,以便我在按钮单击时执行的操作如下:

function clearHeaderData() 
{
   $('#companies').dataTable().empty();
   $('#companies').dataTable().fnDestroy();
   makeTableClear(); //here I creating new datatable. I call it wherever I need to create dataTable.

}

问题:

当我单击该按钮时,将调用clearHeaderData()并抛出错误"无效参数"在fnDestroy(); 错误位置是jquery.dataTables.min.js行:200 CHAR:265,其中包含以下代码:

 a.nTable.insertBefore(i, a.nTable.childNodes[0]);

问题只发生在IE中。它在chrome和firefox中运行良好。

我在Google上阅读了很多关于它的内容,但没有任何效果。希望能找到你们的指导。

此致 密斯巴。

function makeTableClear()
            {
$( "#formAddNewRow" ).dialog({ autoOpen: false, title: 'Please fill the form:', width: 520, height: 480, modal: true });

         //   alert("in clear table");
             $("#companies").dataTable({
            "bServerSide": false,
            //sScrollY: '250px',
            //sScrollX: '750px',
            //"sAjaxSource": "public_html/ajax/data/arrays.txt",
           // "sAjaxSource": "http://127.0.0.1:7101/CURDExample-CURDViewController-context-root/CompanyAjaxDataSource",
            //"sAjaxSource": "http://127.0.0.1:7101/HSEApplication-ViewController-context-root/FireFightingServlet",
            "bProcessing": true,
            "bRetrieve": true,
            "bDestroy": true, 
            "bAutoWidth": false,
            "sPaginationType": "full_numbers",
            "bJQueryUI": true,
            "sScrollX": "100%",
            "sScrollXInner": "150%",
    "bScrollCollapse": true,
            "bAutoWidth": false, // Disable the auto width calculation
            "aoColumns": [
                          {  "sName": "ID",
                             "bSearchable": false,
                             "bSortable": false,
                             "bVisible": false
                                 },
                  {  "sName": "Type" },
                  { "sName": "Location" }, 
                  { "sName": "Easily Accessible" },
                  { "sName": "Operating Instruction Visible" },
                  {  "sName": "Safety Seal" },
                  { "sName": "Fulness Determined By" },                 
                  { "sName": "Pressure Gauge" },
                  { "sName": "Cylinder Condition" },
                  {  "sName": "Nozzle/Hose Pipe Condition" },
                  { "sName": "Tires Condition" },                 
                  { "sName": "Status" },
                  { "sName": "Conducted By" }
                 ]      

     }).makeEditable({
            sAddURL: "../FireFightingDetailServlet?action=addDetail",//&HID="+document.getElementById("headerId").value,
            sUpdateURL: "../FireFightingDetailServlet?action=updateDetail",
           sDeleteURL: "../FireFightingDetailServlet?action=deleteDetail",
             fnShowError: function (message, action) 
             {
                    switch (action) {
                    case "update":
                            if (message=="")alert("Update successful");
                            else alert(message);
                            break;
                    default: alert(message);

                    }
                },

                "aoColumns": [
                         {
                              //cssclass: "required"
                                  indicator: 'Saving...',
                              tooltip: 'You may change the field by double click ',
                              loadtext: 'loading...',
                              type: 'select',
                              onblur: 'submit',
                                  data: '{"CO2":"CO2","DCP":"DCP","AFFF": "AFFF","Water":"Water"}'
                          },//null for read-only columns
                                {
                              cssclass: "required",
                                  indicator: 'Saving...',
                              tooltip: 'You may change the field by double click ',
                              loadtext: 'loading...',
                              type: 'text',
                              onblur: 'submit'
                                },

                            {
                              //cssclass: "required"
                                  indicator: 'Saving...',
                              tooltip: 'You may change the field by double click ',
                              loadtext: 'loading...',
                              type: 'select',
                              onblur: 'submit',
                                  data: '{"Yes":"Yes","No":"No"}'
                          },
                          {
                              indicator: 'Saving...',
                              tooltip: 'Click to select town',
                              loadtext: 'loading...',
                              type: 'select',
                              onblur: 'submit',
                                  data: '{"Yes":"Yes","No":"No"}'
                          },

                          {
                              indicator: 'Saving...',
                              tooltip: 'Click to select town',
                              loadtext: 'loading...',
                              type: 'select',
                              onblur: 'submit',
                              data: '{"Ok":"Ok","Missing":"Missing","Broken": "Broken"}'
                          },
                              {
                              indicator: 'Saving...',
                              tooltip: 'Click to select town',
                              loadtext: 'loading...',
                              type: 'select',
                              onblur: 'submit',
                              data: '{"Weighing":"Weighing","Pressure Gauge":"Pressure Gauge"}'
                          },
                              {
                              indicator: 'Saving...',
                              tooltip: 'Click to select town',
                              loadtext: 'loading...',
                              type: 'select',
                              onblur: 'submit',
                              data: '{"Green":"Green","Red":"Red"}'
                          },
                              {
                              indicator: 'Saving...',
                              tooltip: 'Click to select town',
                              loadtext: 'loading...',
                              type: 'select',
                              onblur: 'submit',
                              data: '{"Ok":"Ok","Not Ok":"Not Ok"}'
                          },
                              {
                              indicator: 'Saving...',
                              tooltip: 'Click to select town',
                              loadtext: 'loading...',
                              type: 'select',
                              onblur: 'submit',
                              data: '{"Ok":"Ok","Not Ok":"Not Ok"}'
                          },
                              {
                              indicator: 'Saving...',
                              tooltip: 'Click to select town',
                              loadtext: 'loading...',
                              type: 'select',
                              onblur: 'submit',
                              data: '{"Ok":"Ok","Not Ok":"Not Ok","N/A":"N/A"}'
                          },
                              {
                              indicator: 'Saving...',
                              tooltip: 'Click to select town',
                              loadtext: 'loading...',
                              type: 'select',
                              onblur: 'submit',
                              data: '{"Fit":"Fit","Not Fit":"Not Fit","Pending":"Pending"}'
                          },//null for read-only columns
                              {
                              cssclass: "required",
                                  indicator: 'Saving...',
                              tooltip: 'You may change the field by double click ',
                              loadtext: 'loading...',
                              type: 'text',
                              onblur: 'submit'
                               }
                      ]


                    }); 
            }

0 个答案:

没有答案