Skip to content
Advertisement

If else statement inside return “ ” statement

Is this possible? I’m trying to hide the Approve Button if the column approvedby is not empty. This is from a Server-Side dataTable. My problem is I can’t find a way for if else to be used because I’m using return "".

This is the script.

This is the result. I can’t seem to find a way for if else to work inside return "".

hide approveby

Advertisement

Answer

Try this

Note I removed the empty() function you used in the if statement.

The reason why it didnt work is because you wrote the if statement as a string so it didnt process as a javascript code.

Here’s an example on how to write inline if statements in javascript.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement