Local editing... Uncaught Unable to find row identifier For more information

Local editing... Uncaught Unable to find row identifier For more information

VinoyNVinoyN Posts: 2Questions: 1Answers: 0

I get the "Unable to find row identifier" when I click on the edit / delete button.

Local data array

rowDataSet = [
            ["row_0", "PD LGD EAD Corporate", "null", "2001-01-01", "Y", "PLECORP", "9999-12-31", 1552979473471, 1, "PD LGD EAD Corporate"],
            ["row_1", "PD LGD EAD Retail", "null", "2001-01-01", "Y", "PLERET", "9999-12-31", 1552979473471, 2, "PD LGD EAD Retail"],
            ["row_2", "Macro Adjusted PD", "1", "2001-01-01", "Y", "MADJPD", "9999-12-31", 1552979473471, 3, "Macro Adjusted PD"],
            ["row_3", "PD Term Structure Matrix", "1", "2001-01-01", "Y", "PDTM", "9999-12-31", 1552979473471, 4, "PD Term Structure Matrix"],
            ["row_4", "Instrument Level LGD", "1", "2001-01-01", "Y", "INSTLGD", "9999-12-31", 1552979473471, 5, "Instrument Level LGD"],
            ["row_5", "Macro Adjusted LGD", "1", "2001-01-01", "Y", "MADJLGD", "9999-12-31", 1552979473471, 6, "Macro Adjusted LGD"],
            ["row_6", "Macro Adjusted EAD", "1", "2001-01-01", "Y", "MADJEAD", "9999-12-31", 1552979473471, 7, "Macro Adjusted EAD"],
            ["row_7", "Expected Credit Loss", "1", "2001-01-01", "Y", "ECL", "9999-12-31", 1552979473471, 8, "Expected Credit Loss"]];

Local header array

dynamicColumnsObj = [{title: "id", name: "id", visible: false, visible: false},
                {title: "approach_desc", name: "approach_desc"},
                {title: "parent_approach_id", name: "parent_approach_id"},
                {title: "eff_start_date", name: "eff_start_date"},
                {title: "current_rec_flag", name: "current_rec_flag"},
                {title: "approach_code", name: "approach_code"},
                {title: "eff_end_date", name: "eff_end_date"},
                {title: "version", name: "version"},
                {title: "approach_id", name: "approach_id"},
                {title: "approach_name", name: "approach_name"}];

My Datatables code

editor = new $.fn.dataTable.Editor({
                table: "#classDataTable",
                idSrc: 'id',
                fields: [ {
                    label: "Approach ID:",
                    name: "approach_id"
                },{
                    label: "Approach Desc:",
                    name: "approach_desc"
                }, {
                    label: "Approach Code:",
                    name: "approach_code"
                }, {
                    label: "Approach Name:",
                    name: "approach_name"
                }, {
                    label: "Effective End Date:",
                    name: "eff_end_date"
                }]
            });
            
            var dTable = $('#classDataTable').DataTable({
                "data" : rowDataSet,
                "destroy" : true,
                "pageLength": 10,
                "order" : [ [ 0, "asc" ] ],
                "columns" : dynamicColumnsObj,
                "dom": "Bfrtip",
                "select": true,
                "buttons": [
                    { extend: "create", editor: editor },
                    { extend: "edit",   editor: editor },
                    { extend: "remove", editor: editor }
                ]
           });

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,142Questions: 1Answers: 2,586
    Answer ✓

    Hi @VinoyN ,

    The problem is because you're using arrays for the data, not objects, so Editor can't find the fields you're naming. The solution is to locate them by their position, see here.

    Hope that gets you going,

    Cheers,

    Colin

  • VinoyNVinoyN Posts: 2Questions: 1Answers: 0

    Hi @colin ,

    Thanks a lot. Locating data by position did the trick.

This discussion has been closed.