Paging dataTable JSON - Parameter passing in a function

0

I have a table that should be paged. It is already receiving the JSON and populating the table, but in the fifth and sixth column I need to do treatments, the content of them will depend on certain condition.

function buscarConteduoBtn(p){
        debugger;
        if (p)
            return "verdadee";
        else
            return "falsoooo";
    };

    $('.tblCargo').dataTable(

        {

            "sDom": "<'row'<'col-md-6'l><'col-md-6'f>r>t<'row'<'col-md-6'i><'col-md-6'p>>",
            "sPaginationType": "bootstrap",
            "bRetrieve": true,
            "bServerSide": true,
            "sAjaxSource": "/Cargo/BuscarListaPaginada",
            "bProcessing": true,
            "bSortClasses": false,

            "aoColumns":
                [
                    {
                        "bSortable": true,
                        "sName": "a",
                        "mData": "a"
                    },
                    {
                        "bSortable": true,
                        "sName": "b",
                        "mData": "b"
                    },
                    {
                        "bSortable": true,
                        "sName": "c",
                        "mData": "c"
                    },
                    {
                        "bSortable": true,
                        "sName": "d",
                        "mData": "d"
                    },
                    {
                        "bSortable": false,
                        "sName": "PodeExcluir",
                        "mData": buscarConteduoBtn("PodeExcluir"),
                        "sClass": "glyphicon-remove",
                        "sDefaultContent": buscarConteduoBtn("PodeExcluir")
                    },
                    {
                        "bSortable": false,
                        "sName": "y",
                        "mData": ""
                    }
                ],


            "fnDrawCallback": function (oSettings) {
                debugger
                setTimeout(function () {
                    LoadingHide();
                }, 400);
            }

    }).DelayAjax(800);

I'm trying to call the buscarConteduoBtn function of both the mData property and the sDefaultContent property, but it does not work.

When I pass:

"sDefaultContent": buscarConteduoBtn(true)

It works perfectly, calls the function and returns what it has to return, when I pass the JSON property value, it always returns true / p>

Does anyone know how to do this to pass the contents of the JSON property to the function?

    
asked by anonymous 16.06.2018 / 01:05

0 answers