Perspective table of hyperlinks - table displays the HTML rather than a link


hm... getting this error when clicking

urllink view

link binding

What am i doing wrong here?

You've configured your View to expect a param of url, but I previously recommended you simply name it value. Then your binding should target view.params.value instead of view.params.url.

That did it! Thanks cmallonee!

So, our of curiosity, why didn't the URL parameter name work?

When the Table sends values to the View rendered within the cell for a given row, it essentially pulls out the value of the key for the column which is rendering the View.

You can think of it like accessing a dictionary. Let's look at two examples:

  1. A more complex entry, where the field in question contains an object with multiple keys
# more complex data entries:
row_data = {
    "bay": 1,
    "t_stamp": 0111542846172,
    "link": {"text": "Click Me", "url": "http://google/com"}
}
value = row_data.get("link")
# result
# value === {"text": "Click Me", "url": "http://google.com"}

In this instance, when the View being used for the cell is built, the params object is merged with the value dictionary, resulting in two defined params ("text" and "url"), along with whatever default params the View has configured.

  1. A super-simple entry like your scenario, where the value to be sent to the View is a plain value.
row_data = {
    "BATCH_NO": 1,
    "VESSEL_NAME": "XYZ",
    "PDFURL": "http://something.com/somethingElse"
}
value = row_data.get("PDFURL")
# result
# value === "http://something.com/somethingElse"

Here, value is a primitive (plain) value with no keys. Well, we can't very well merge that with the param dictionary of the View because they're different types. So we make a new dictionary with a key of value and assign this primitive to the key. As a result, the View used for rendering the cell has a dictionary with one key (value) merged into its existing param entries.

In your case, you specified a url param in the View to be rendered in the cell, but nowhere in this chain of events did you configure your data to have a url key at any level of your data structure.

1 Like