-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Category
- Question
- Bug
- Enhancement
Expected or Desired Behavior
The use of @currentField
allows you to request specific values when the field is an object (Person and Lookup). This works great if you need the person's name since you can just use @currentField.title
.
However, other fields don't return as objects they return as separate values with a . in the name. For example, a Hyperlink field comes back as FieldName and FieldName.desc both as top level properties (not as an object).
It is expected that you would be able to pass @currentField
with a Hyperlink field to get the URL and then pass @currentField.desc
to get the display value.
Observed Behavior
The _evalJsonPath
method splits the @currentField
value on the period then evaluates the results from the row object using only the first portion. This makes it impossible to retrieve properties that contain the . as is the case with Hyperlink fields.
So no combination of @currentField
or [$FieldName]
will work since the . is always stripped out before the evaluation is done. So although the FieldName.desc value exists it is comletely inaccessible and an error will always return.
Steps to Reproduce
Apply custom formatting to a Hyperlink column and set the txtContent
to @currentField.desc
Suggested Fix
Instead of immediately splitting the value in the _evalJsonPath
method then evaluating the parts, a check against the row for the existence of the property as passed should be done. Something like:
this._params.row["someLink.desc"]
If this evaluates, then that's the value that should be used and you can skip the splitting and object evaluation that current exists (and works for User and Lookup fields).
Alternatively, a check could be made for the field type (as is done with Number, User, and Lookup) and if it is a Hyperlink then the evaluation could be simplified.