How to have a variable inside a dt.column(x).data()

How to have a variable inside a dt.column(x).data()

bigracefan18bigracefan18 Posts: 15Questions: 2Answers: 0

My goal is to have have a button not appear with a certain class. That works fine. The next part is to dynamically pick the column through the drawback. I set it in that routine but I can't figure out the syntax for the function I created.

var DCIDColumn ="1";
......some code......

"drawCallback": function( settings ) {
            var check= $s('.DOETable').hasClass( "DOEDTHID" );
            console.log(check);
            DCIDColumn = "0" ;
            if (check==false)
            {
            $s('.DOEcustom').remove();

            }

        },
        buttons: [
        {
            extend: 'excel',
            exportOptions: {
                columns: ':visible'
            }
        }

        ,
        {
            extend: 'pdfHtml5',
             orientation: strOrientation,

             exportOptions: {
                columns: ':visible',
                title: DOETableHeadHTML


            }

        }
        ,
        {
            extend: 'print',
            text: strPrint,
            message: "<table class='DOETableHead'>" + DOETableHeadHTML + "</table>",
            exportOptions: {
                columns: ':visible'
            }

        }
        ,
          {
        text: strSetSelection,
        className: 'DOEcustom',
        action: function ( e, dt, node, config ) {
        setSelection("set", dt.column(0).data());

        }
    }
        ]
    }
}

I want to have something like this:
setSelection("set", dt.column(DCIDColumn).data());
I'll have another routine that will set the DCIDColumn. But for now I'm just trying to see if it'll work.

Replies

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

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.