0

I'm trying to insert a DataTables Editor-based table into a WordPress page (seen here), and I'm running into the following error: TypeError: f[("editor_" + c)] is undefined

What's puzzling about this is that I used jQuery(function ($) { to get out of noConflict mode, yet this issue is still occuring.

Any ideas why?

This is the jQuery I'm using to build the table:

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 }
                ]
            }
        } );
    });
});
4

1 回答 1

0

发现 TableTools 需要在 Editor 之前加载。一旦在编辑器之前为 TableTools 调用“wp_enqueue_script”,一切正常。

于 2013-08-21T15:38:19.523 回答