Unable to find row identifier

Unable to find row identifier

belethanbelethan Posts: 7Questions: 1Answers: 0
edited November 2016 in Free community support

The server sent back the following data and when you click the edit or delete button, an error message is returned 'Uncaught Unable to find row identifier "

{draw: "1", recordsFiltered: 3, recordsTotal: 3,…}
data:[{DT_RowID: "row_1", name: "bleu", info: "theme essais direct"},…]
0:{DT_RowID: "row_1", name: "bleu", info: "theme essais direct"}
DT_RowID:"row_1"
info:"theme essais direct"
name:"bleu"
1:{DT_RowID: "row_2", name: "rouge", info: "test 2 "}
DT_RowID:"row_2"
info:"test 2 "
name:"rouge"
2:{DT_RowID: "row_3", name: "violet", info: "test 3"}
DT_RowID:"row_3"
info:"test 3"
name:"violet"
draw:"1"
recordsFiltered:3
recordsTotal:3

JS code is:

       table.DataTable({
            serverSide: true, // enable/disable server side ajax loading
            sDom: '<"dt-panelmenu clearfix"l<"btn-group-table col-xs-4"B>fr>t<"dt-panelfooter clearfix"ip>',
            sAjaxSource: 'view/',
            select:true,
            aoColumns: [
                {mData: "name"},
                {mData: "info"}
            ],
            columnDefs: [
                { "name" : "name","sWidth": "30%",'orderable': true,"searchable": true,'targets': [0]},
               { "name" : "info","sWidth": "25%",'orderable': true, "searchable": true,"targets": [1]}
            ],
            lengthChange: false,
            buttons: [
                { extend: 'create', editor: editor },
                { extend: 'edit',   editor: editor },
                { extend: 'remove', editor: editor }
            ]
        })

I do not know how to solve the problem. have you ever had the problem?

jquery 1.12.3
DataTable 1.10.12
Editor 1.5.6

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

This question has accepted answers - jump to:

Answers

  • belethanbelethan Posts: 7Questions: 1Answers: 0

    Here more information about the html code of dataTable. no ID on lbalise TR and I do not know why

  • belethanbelethan Posts: 7Questions: 1Answers: 0
    edited November 2016

    after some research I have code that is not the ID assignment on TR
    Someone he already had the problem?

    the function is in the file jquery.dataTables.js

    function fnRowAttributes( settings, row )
    var data = row._aData;
    data content = Object {DT_RowID: "1", name: "bleu", info: "theme essais direct"}

    id = settings.rowIdFn( data );

    ** and id is undefined.**

    Please if you can help me, I do not understand why it returns null

  • allanallan Posts: 63,819Questions: 1Answers: 10,517 Site admin
    Answer ✓

    Could you show me your Editor initialisation? Are you setting the idSrc option?

    If you could link to the page please I would be able to identify the issue immediately and let you know what the problem is.

    Allan

  • belethanbelethan Posts: 7Questions: 1Answers: 0

    thank you for your quick response and it joined the editor's statement
    No I have not used idSrc

    editor = new $.fn.dataTable.Editor( {
                ajax: {
                    create: {
                        type: 'POST',
                        url:  'add'
                    },
                    edit: {
                        type: 'PUT',
                        url:  'edit'
                    },
                    remove: {
                        type: 'DELETE',
                        url:  'delete'
                    }
                },
                table: table,
                fields: [
                    {
                        "label": "nom théme:",
                        "name": "name"
                    },
                    {
                        "label": "info:",
                        "name": "info",
                        "type": "textarea"
                    }
                ],
                i18n: {
                    create: {
                        button: "Nouveau",
                        title:  "Créer nouvelle entrée",
                        submit: "Valider"
                    },
                    edit: {
                        button: "Modifier",
                        title:  "Modifier entrée",
                        submit: "Valider"
                    },
                    remove: {
                        button: "Supprimer",
                        title:  "Supprimer",
                        submit: "Valider",
                        confirm: {
                            _: "Etes-vous sûr de vouloir supprimer %d lignes ?",
                            1: "Etes-vous sûr de vouloir supprimer 1 ligne ?"
                        }
                    },
                    error: {
                        system: "Une erreur s’est produite, contacter l’administrateur système"
                    },
                    datetime: {
                        previous: 'Précédent',
                        next:     'Premier',
                        months:   [ 'Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre' ],
                        weekdays: [ 'Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam' ]
                    }
                }
            } );
    
    
  • allanallan Posts: 63,819Questions: 1Answers: 10,517 Site admin
    Answer ✓

    Interesting. I'm afraid I don't see any reason why the above wouldn't work.

    Could you give me a link to the page so I can debug it directly please? PM me by clicking my name above and then Send message if you don't want to make it public.

    Allan

  • belethanbelethan Posts: 7Questions: 1Answers: 0

    I can not make available the pages from the outside because I am on VM that does not allow incoming access.
    The source part is written CAKEPHP 3.0

    I just reload the latest version of datatables and editor and I have no error but when the form editor opens the data are not loaded and TR tag has not ID.

    Can there be conflict with the various JS files?
    I fear it :( .
    thank you very much for your attention to my problem. I recondtionner my environment to avoid conflict.
    I'll keep you informed on developments.

  • allanallan Posts: 63,819Questions: 1Answers: 10,517 Site admin

    I guess it is possible. If that is the case I would expect there to be an error shown in the Javascript console in your browser. Is there?

    Can you run the debugger on your page?

    Allan

  • belethanbelethan Posts: 7Questions: 1Answers: 0

    I did not know this debug solution.
    Here is the code for ebicis analysis.
    Thanks a lot for your help.

  • allanallan Posts: 63,819Questions: 1Answers: 10,517 Site admin

    Thanks for the debug code - I've got it now.

    The issue is one of capitalisation. The JSON for your records contains DT_RowID, however, the default that DataTables looks for is DT_RowId. Note the change in case of the last d.

    If you change it to be DT_RowId, I believe it should work as expected.

    Allan

  • belethanbelethan Posts: 7Questions: 1Answers: 0

    You are right and I congratulate you for having found the error.
    you are great and I hope to help you in return another.
    thank you very much

This discussion has been closed.