Editor Trial Question

Editor Trial Question

AshleyJuddAshleyJudd Posts: 6Questions: 1Answers: 0
edited August 2020 in Free community support

I am evaluating datatables editor.
I have done some tests against a mysql database in localhost and I have followed that it works well, but I have passed it to a hosting server and there only adding records works.
Edit and Delete buttons both give this error:

Uncaught Unable to automatically determine field from source. Please specify the field name. For more information, please refer to https://datatables.net/tn/11

Does the 15-day trial version have any limitations?

-----------Debug information--------
I put this code in Button edit action:

                        var rowData = dt.row({selected:true}).data();

                        console.log ('rowData: ');

                        str = JSON.stringify(rowData);
                        str = JSON.stringify(rowData, null, 4); // (Optional) beautiful indented output.
                        console.log(str); // Logs output to dev tools console.

And the result are:

rowData:

 {
    "DT_RowId": "row_4",
    "actividades": {
        "id": "4",
        "actividad": "Patinaje 1",
        "maximo": "1",
        "dias": "12",
        "color": "#ffffff",
        "F_ACTIVA_DESDE": "2020-08-01 01:38:13",
        "F_ACTIVA_HASTA": "2020-08-31 12:00:00"
    },
    "info": {
        "ya_asignadas": "0",
        "diferencia": "1"
    }
}

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

Answers

  • kthorngrenkthorngren Posts: 21,330Questions: 26Answers: 4,951

    Does the 15-day trial version have any limitations?

    No. Did you follow the instructions in the link provided?
    https://datatables.net/tn/11

    If you still need help please post your Editor and Datatables configs. Please use Markdown code formatting with triple backticks (```) on new lines.

    Kevin

  • AshleyJuddAshleyJudd Posts: 6Questions: 1Answers: 0

    Thanks kthorngren,
    yes, I read https://datatables.net/tn/11 and a lot of Discussions about that in datatables.net forum and other like stackoverflow

    As I said before, the same code, without any changes, works on a localhost server with Windows, Apache, MySQl and PHP, but on a hosting (1and1, ionos) with Linux, Apache, MySQl and PHP server it gives the error that I have commented.
    I have checked upper and lower case in the names of the database fields.

    My Javascrip code for creating the DataTable, Editor and Buttons objects is this:

                var editor = new $.fn.dataTable.Editor( {
            ajax: '<?php echo URL_ACTIVIDADES;?>crud/defineEditor.php',
                    table: '#DTactividades',
                    idSrc: 'actividades.id',
                    title: 'Tipos de Actividades',
                    display: "jqueryui",
                    fields: [
                        {
                            label:      "id:",
                            name:       "actividades.id",
                            data:       "actividades.id",
                            type:       "hidden"
                        },
                        {
                            label:      "actividad:",
                            name:       "actividades.actividad",
                            data:       "actividades.actividad",
                            type:       "text"
                        },
                        {
                            label:      "maximo:",
                            name:       "actividades.maximo",
                            data:       "actividades.maximo",
                            def:        1
                        },
                        {
                            label:      "dias:",
                            name:       "actividades.dias",
                            data:       "actividades.dias"
                        },
                        {
                            label:      "color:",
                            name:       "actividades.color",
                            data:       "actividades.color",
                            type:       "text",
                            def:        "#ffffff"
                        },
                        {
                            label:      "Fecha Activa Desde:",
                            name:       "actividades.F_ACTIVA_DESDE",
                            data:       "actividades.F_ACTIVA_DESDE",
                            type:       "datetime",
                            def:        function () { return new Date(); },
                            format:     "YYYY-MM-DD hh:mm:ss",
                            opts: {
                                minutesIncrement: 1
                            }                        
                        },
                        {
                            label:      "Fecha Activa Hasta:",
                            name:       "actividades.F_ACTIVA_HASTA",
                            data:       "actividades.F_ACTIVA_HASTA",
                            type:       "datetime",
                            def:        function () { return new Date(); },
                            format:     "YYYY-MM-DD hh:mm:ss",
                            opts: {
                                minutesIncrement: 1
                            }                        
                        },
                        {
                            label:      "Ya Asignadas:",
                            name:       "info.ya_asignadas",
                            data:       "info.ya_asignadas",
                            type:       "hidden"                
                        },
                        {
                            label:      "Diferencia:",
                            name:       "info.diferencia",
                            data:       "info.diferencia",
                            type:       "hidden"                
                        },
                    ],
                    i18n: {
                        close: 'Cerrar',
                        create: {
                            button: "Nuevo",
                            title:  "Crear nuevo registro",
                            submit: "Grabar"
                        },
                        edit: {
                            button: "Modificar",
                            title:  "Modifiar registro",
                            submit: "Actualizar"
                        },
                        remove: {
                            button: "Eliminar",
                            title:  "Eliminar Registro",
                            submit: "Eliminar",
                            confirm: {
                                _: "Está usted seguro de eliminar %d registros ?",
                                1: "Está usted seguro de eliminar 1 registro ?"
                            }
                        },
                        error: {
                            system: "Se ha producido un error. Contacte con el administrador"
                        },
                        datetime: {
                            previous: 'Anterior',
                            next:     'Siguiente',
                            months:   [ 'Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre' ],
                            weekdays: [ 'Dom', 'Lun', 'Mar', 'Mie', 'Jue', 'Vie', 'Sab' ]
                        }
                    }                    
                } );
                
                var table = $('#DTactividades').DataTable( {
            ajax: :    '<?php echo URL_ACTIVIDADES;?>crud/defineEditor.php',
                    idSrc: 'actividades.id',
                    ServerSide: true,
                    columnDefs: [
                        {
                            targets: [1,3,4,5,6,7,8],
                            className: 'order-column dt-body-center'
                        }
                      ],
                                        columns: [
                        { /* 1º Columna con un checkBox para seleccionar claramente cada una de las filas de la tabla */
                            targets: 0,
                            data: null,
                            defaultContent: '',
                            orderable: false,
                            className: 'select-checkbox'
                        },
                        {
                            data: "actividades.id"
                        },
                        {
                            data: "actividades.actividad"
                        },
                        {
                            data: "actividades.maximo"
                        },
                        {
                            data: "actividades.dias"
                        },
                        {
                            data: "info.ya_asignadas"
                        },
                        {
                            data: "info.diferencia"
                        },
                        {
                            data: "actividades.color"
                        },                    
                        { /* Columna final con uno o varios botones de acción asociados al ID de la actividad */
                            data: 'actividades.id',
                            render: function(data, type, row, meta) {
                                return type === 'display' ?
                                        '<div class="btn-group">' + 
                                        '    <button type="button" id="btnAccionActividad" onclick="editarActividad(' + data + ')"  title="Editar Tipo de Actividad" class="btn btn-warning btn-gradient botonAccion"> <span class="glyphicons glyphicons-knight"></span> </button>' + 
                                        '</div>'
                                    :
                                    data;
                            },
                            orderable: false
                        },                              
                                    ],
                    select: {
                        style:    'os',
                        blurable: true,
                        selector: 'td:first-child'
                    },
                    order: [[ 1, 'asc' ]],
                                    lengthChange: true,
                    language: {
                        "url": "<?php echo adm_DataTablesIdiona();?>"
                        },
                    responsive: true,
                    pageLength: 50,
                    dom:"ftip"
                });
                
                new $.fn.dataTable.Buttons( table, [
                        { extend: "create", editor: editor, text: "Agregar Tipo de Actividad" },
                        { extend: "edit",   editor: editor, text: "Modificar" },
                        { extend: "remove", editor: editor, text: "Eliminar" }
                ] );
    
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Can you show me the response from the server when you perform the edit? The browser's network tab will show you what it is.

    Allan

  • AshleyJuddAshleyJudd Posts: 6Questions: 1Answers: 0
    edited August 2020

    Nothing change in Network Tab after click "Edit" Button.
    Only this message in Console Tab:

    Uncaught Unable to automatically determine field from source. Please specify the field name. For more information, please refer to https://datatables.net/tn/11

    dataTables.editor.min.js:21

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    That error suggests you are using inline or bubble editing, but I don't see either being used in the code above. Is that just because the code is incomplete? If so, can you show me the full code, and also tell me which column you are clicking on to trigger that error.

    Even better would be if you can link me to the page you are having problems with please?

    Thanks,
    Allan

  • AshleyJuddAshleyJudd Posts: 6Questions: 1Answers: 0

    :o :o :o

    Without having made any changes to my code, today I have accessed again to send you an answer and ...
    WORKS !!
    I don't understand what happens.
    I have 3 days left to evaluate your Datatables Editor.
    I will try to dedicate the maximum time to it to be able to evaluate the use and inform my project managers :-)

    Thanks for your time.
    Testing is being done on a system with user validation and sensitive data, sorry I am not allowed to share the URL.

    If it fails again, I'll try to send a video anyway, though I don't think it will help.

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    If you run out of time with the trial, just let me know. We can reset it for you - you'll get an e-mail at the end of the trial and you can reply to that.

    Allan

  • AshleyJuddAshleyJudd Posts: 6Questions: 1Answers: 0

    :) :) :)

  • AshleyJuddAshleyJudd Posts: 6Questions: 1Answers: 0

    Allan,
    can you reset my trial time?

    I need a little more time to try to convince my bosses.

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

    Yep, I've just extended, so that should get you going again. Shout if you have any problems,

    Colin

This discussion has been closed.