Conditional Image with a Link

QuestionsConditional Image with a Link
Gerd asked 7 years ago

Hallo Abu,

i want to show in a column(Values 0/1) an image with an link on click. The Image should only appear, when the value of the grid-cell ist "1".

What have i to do?

regards
Gerd

1 Answers
Abu Ghufran answered 7 years ago

You can refer demos/appearance/conditional-data.php

$img = "<a target='_blank' href='http://www.amazon.com?id={id}' style='text-decoration:none; white-space:none; border:1px solid gray; padding:2px; position:relative; width:25px; color:red'><img src='{path_src}'></a>";

# use single quote for condition, and $row will have all columns data, to use in condition (can also use {total} or {amount})
$col["condition"] = array('$row["total"] == 1', '', $img);
$cols[] = $col;

You can also check on_data_display event in docs > conditional content (http://phpgrid.org/docs)

Your Answer

5 + 8 =

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?