No me aparecen los botones de acciones "create", "edit" y "remove"

No me aparecen los botones de acciones "create", "edit" y "remove"

Luna.taptapLuna.taptap Posts: 1Questions: 1Answers: 0
edited August 2023 in Free community support
editor = new $.fn.dataTable.Editor( {
        ajax: "controllers/productos.php",
        table: "#tablaProductos",
        fields: [ {
                label: "Nombre:",
                name: "nombre"
            }, {
                label: "Precio:",
                name: "precio"
            }, {
                label: "Existencia:",
                name: "existencia"
            }, {
                label: "Imagenes:",
                name: "files[].id",
                type: "uploadMany",
                display: function ( fileId, counter ) {
                    return '<img src="'+editor.file( 'files', fileId ).web_path+'"/>';
                },
                noFileText: 'No hay imagenes'
            }
        ]
    } );
 
    $('#tablaProductos').DataTable( {
        dom: "Bfrtip",
        ajax: "controllers/productos.php",
        columns: [
            { data: "nombre" },
            { data: "precio", render: $.fn.dataTable.render.number( ',', '.', 0, '$' ) },
            { data: "existencia" },
            {
                data: "files",
                render: function ( d ) {
                    return d.length ?
                        d.length+' imagen(es)' :
                        'No hay imagen(es)';
                },
                title: "Imagen"
            }
        ],
        select: true,
        buttons: [
            { extend: "create", editor: editor },
            { extend: "edit",   editor: editor },
            { extend: "remove", editor: editor }
        ]
    } );



Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

  • rf1234rf1234 Posts: 2,993Questions: 87Answers: 421

    Your data table definition looks ok. What error message are you getting?

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Also, have you included the Editor source files in your page? It would be worth confirming in the browser's developer tools in case there's a load order issue.

    Colin

Sign In or Register to comment.