Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Datatables 将导出按钮添加到数据库编辑器_Datatables_Jquery Datatables Editor - Fatal编程技术网

Datatables 将导出按钮添加到数据库编辑器

Datatables 将导出按钮添加到数据库编辑器,datatables,jquery-datatables-editor,Datatables,Jquery Datatables Editor,在使用Datatables编辑器插件时,我尝试在“新建”、“编辑”和“删除”按钮之外添加导出(excel、csv等)按钮。 我的原始代码: new $.fn.dataTable.Buttons( table, [ { extend: "create", editor: editor }, { extend: "edit", editor: editor }, { extend: "rem

在使用Datatables编辑器插件时,我尝试在“新建”、“编辑”和“删除”按钮之外添加导出(excel、csv等)按钮。 我的原始代码:

    new $.fn.dataTable.Buttons( table, [
        { extend: "create", editor: editor },
        { extend: "edit",   editor: editor },
        { extend: "remove", editor: editor }
    ]);
    table.buttons().container()
        .appendTo( $('.col-md-6:eq(0)', table.table().container() ) );
} );
然后,我尝试添加如下“导出”按钮:

[
            { extend: "create", editor: editor },
            { extend: "edit",   editor: editor },
            { extend: "remove", editor: editor },
            {
                extend: "collection",
                text: 'Export',
                buttons: [
                    "copy",
                    "excel",
                    "csv",
                    "pdf",
                    "print"
                ]
            }
        ]
                {
                    extend: 'excel',
                    
                },
                {
                    extend: 'pdf',
                   
                },
                {
                    extend: 'csv',
                   
                },
               {
                    extend: 'print',
                   
                },
                 {
                     extend: 'copy',
                   
                }

但它不起作用…

您的按钮定义应如下所示:

[
            { extend: "create", editor: editor },
            { extend: "edit",   editor: editor },
            { extend: "remove", editor: editor },
            {
                extend: "collection",
                text: 'Export',
                buttons: [
                    "copy",
                    "excel",
                    "csv",
                    "pdf",
                    "print"
                ]
            }
        ]
                {
                    extend: 'excel',
                    
                },
                {
                    extend: 'pdf',
                   
                },
                {
                    extend: 'csv',
                   
                },
               {
                    extend: 'print',
                   
                },
                 {
                     extend: 'copy',
                   
                }

它们是单独的按钮,而不是单个按钮。您可以按任意顺序添加它们,因此,如果您想在“添加、编辑、删除”按钮之后添加它们,只需在这些按钮之后添加这些定义。

您的按钮定义应如下所示:

[
            { extend: "create", editor: editor },
            { extend: "edit",   editor: editor },
            { extend: "remove", editor: editor },
            {
                extend: "collection",
                text: 'Export',
                buttons: [
                    "copy",
                    "excel",
                    "csv",
                    "pdf",
                    "print"
                ]
            }
        ]
                {
                    extend: 'excel',
                    
                },
                {
                    extend: 'pdf',
                   
                },
                {
                    extend: 'csv',
                   
                },
               {
                    extend: 'print',
                   
                },
                 {
                     extend: 'copy',
                   
                }
它们是单独的按钮,而不是单个按钮。您可以按任何顺序添加它们,因此如果您希望在“添加、编辑、删除”按钮之后添加它们,只需在这些按钮之后添加这些定义即可