Conditional

QuestionsConditional
Alberto asked 2 years ago

Hello,

I want to give a cell a value if its empty.
How would be the best way of doing that condition?

Thank you and regards.

3 Answers
Abu Ghufran answered 2 years ago
Alberto answered 2 years ago

It isn't a currency field.
would it be the same?

Abu Ghufran answered 2 years ago

It was just for demo code to make similar. I think following should work.

PHP:
$col["formatter"] = "function(cellval,options,rowdata){ return formatField(cellval,options,rowdata); }";
$col["unformat"] = "function(cellval,options,cell){ return unformatField(cellval,options,cell); }";

JS:
<script>
function formatField(cellval,options,rowdata)
{
if(cellval === undefined || cellval === 'NULL' || cellval === '')
return '-';

return cellval;
}

function unformatField(cellval,options,rowdata)
{
if(cellval === '-')
return '';

return cellval;
}
</script>

Your Answer

16 + 15 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating / 5. Vote count:

We are sorry that this post was not useful for you!

Let us improve this post!