Using render with consition on global variables ?

Using render with consition on global variables ?

antidotantidot Posts: 8Questions: 2Answers: 0

Hi.

I read the documentation forward and backward but still couldn' figure it out...

all im trying to do is a condition inside the render function based on a global boolean

var boolean = false;

"render": function ( data, type, full, meta ) { if (boolean){return something }else{ return something else } }

but this is completely ignored.
I'm just trying to wrap my head arround this before trying things out. Any Explanation is very welcome :-)

Answers

  • kthorngrenkthorngren Posts: 21,160Questions: 26Answers: 4,921

    There is nothing special about using global variables. It just needs to be declared before you initialize Datatables and available in the scope of the function Datatables is defined in. Here is an example:
    http://live.datatables.net/yetekubo/2/edit

    Kevin

  • kthorngrenkthorngren Posts: 21,160Questions: 26Answers: 4,921
    edited September 2019

    Just noticed something. Your variable is boolean is a reserved word in Javascript. Maybe thats why its not working.

    Kevin

  • antidotantidot Posts: 8Questions: 2Answers: 0

    ....

    Just working fine. the boolean got returned as a string ... omg

This discussion has been closed.