2013-08-20 43 views
0

我試圖插入一個數據表編輯器爲基礎的表到一個WordPress頁面(看到here),和我運行到以下錯誤:TypeError: f[("editor_" + c)] is undefinedjquery插件在noConflict模式之外拋出「TypeError」?

什麼納悶這是我用jQuery(function ($) {擺脫noConflict模式,但這個問題仍然存在。

任何想法爲什麼?

這是jQuery的我使用建表:

jQuery(function ($) { 
    $(document).ready(function(e) { 
     var editor = new $.fn.dataTable.Editor({ 
      "ajaxUrl": "../wp-content/plugins/contacts/php/table.wp_contacts.php", 
      "domTable": "#wp_contacts", 
      "fields": [ 
       { 
        "label": "Contact", 
        "name": "contact", 
        "type": "text" 
       }, 
       { 
        "label": "Company", 
        "name": "company", 
        "type": "text" 
       }, 
       { 
        "label": "Email", 
        "name": "email", 
        "type": "text" 
       }, 
       { 
        "label": "Phone", 
        "name": "phone", 
        "type": "text" 
       }, 
       { 
        "label": "Fax", 
        "name": "fax", 
        "type": "text" 
       }, 
       { 
        "label": "Tax ID", 
        "name": "tax_id", 
        "type": "text" 
       }, 
       { 
        "label": "Address", 
        "name": "address", 
        "type": "text" 
       } 
      ] 
     }); 
     $('#wp_contacts').dataTable({ 
      "sDom": "Tfrtip", 
      "sAjaxSource": "../wp-content/plugins/contacts/php/table.wp_contacts.php", 
      "aoColumns": [ 
       { 
        "mData": "contact" 
       }, 
       { 
        "mData": "company" 
       }, 
       { 
        "mData": "email" 
       }, 
       { 
        "mData": "phone" 
       }, 
       { 
        "mData": "fax" 
       }, 
       { 
        "mData": "tax_id" 
       }, 
       { 
        "mData": "address" 
       } 
      ], 
      "oTableTools": { 
       "sRowSelect": "multi", 
       "aButtons": [ 
        { "sExtends": "editor_create", "editor": editor }, 
        { "sExtends": "editor_edit", "editor": editor }, 
        { "sExtends": "editor_remove", "editor": editor } 
       ] 
      } 
     }); 
    }); 
}); 

回答

0

發現,需要TableTools到編輯器之前加載。一旦編輯器之前爲TableTools調用了「wp_enqueue_script」,一切都奏效了。