Conditional

QuestionsConditional
Alberto asked 7 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 7 years ago
Alberto answered 7 years ago

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

Abu Ghufran answered 7 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

14 + 11 =

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 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

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

Let us improve this post!

Tell us how we can improve this post?