var undefined

var undefined

rrzavaletarrzavaleta Posts: 78Questions: 52Answers: 2
edited January 2015 in Editor

I am using columns using joins

columns: [  
                    { data: "ING_ASEG_BANCO.ID"
                    ,width: "50%"
                    
                    },
                    
                    { data: "ING_BANCO.NOM_BANCO"
                    ,width: "50%"
                    
                    },
                    
                    { data: "ING_ASEG_BANCO.CUENTA_BANCO"
                    ,width: "50%"
                    
                    }

I usually use this function to clear , with a personalized message to know that I'm erasing field

$('#ing_campoinferior').on('dblclick', 'td', function (e) {
            var row = $(this).parents("td")[0];
            var aPos = oTable.fnGetPosition(this);
            var cta_banco = oTable.fnGetData(aPos[0])["ID"];     
            e.preventDefault();
             editor
             .title( "BORRAR  "+ cta_banco)
            .message('ADVERTENCIA : Esta seguro que desea borrar: ' + cta_banco)
            .buttons( { "label": "Borrar : " +  cta_banco, "fn": function () { editor.submit() } } )
            .remove( $(this).closest('tr') );

    } );

variable cta_banco me messages appear as "undefined" .

How do I can show the name of the column or a cell?

This question has an accepted answers - jump to answer

Answers

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

    I would suggest using the DataTables 1.10 API methods rather than the old fnGetPosition and fnGetData options. Specifically, you might use:

    var rowData = table.row( $(this).closest('tr') ).data();
    var cta_banco = rowData.ING_ASEG_BANCO.ID;
    
    ...
    

    I think the bit you are missing is accessing the nested data, since ID is a property of a sub-object.

    Allan

This discussion has been closed.