Dependent columndef
Dependent columndef
karlie
Posts: 83Questions: 17Answers: 0
columndef when value of other column is 'x'
I have a column called 'Type' with 3 options EACH, PCT,GRAM
I want to set a column definition for the 'Price' column If 'Type' = PCT
{ targets: ['price'], render: function (data, type, row, meta) {var row['type'] == ['PCT'];return row['ct'] * row['ppct'];} },
The above code doesn't work, but any pointers would be fab.
This discussion has been closed.
Answers
I don't believe your Javascript is correct. The
var row['type'] == ['PCT'];
uses a comparison operator rather than an assignment among a few other issues with it.Try:
Allan
I tried this but it gives an Uncaught SyntaxError: Unexpected token if
Your function doesn't seem to have an opening curly brace.
Thanks for the help Tangerine & Allan, this worked for me in the end
Not sure if it's the most efficient way to be honest as I'm a bit out of my depth!