Rank: Newbie
Groups: Registered
Joined: 4/18/2016(UTC) Posts: 8  Location: Dallas, TX
|
I'd like to be able to dynamically change the color of say a label's text color based on some condition. Is this possible. The only possiblility I can see is something called 'browser css class.' Can I set up different classes and use XPath to select them possibly?
|
|
|
|
Rank: Administration
Groups: Registered, Administrators Joined: 7/21/2014(UTC) Posts: 487
Was thanked: 83 time(s) in 83 post(s)
|
No need to use Browser CSS class, unless you design it for execution in browser and you are required to use CSS.
Simply click the Text Color property and then click XPath toolbar button above to enter your XPath statement.
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 4/18/2016(UTC) Posts: 8  Location: Dallas, TX
|
I see! Not immediately evident as if no xpath has been entered, it shows the pallet icon to the righ in the Syles and Properties pane. Works fine though. Thanks
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 4/18/2016(UTC) Posts: 8  Location: Dallas, TX
|
Another item I'm having difficulty with: I have a repeating table on which I'm mapping the text color based on the items 'state'. However, it only seems to evaluate on the first item. In otherwords it'll be blue unless the first item regardless of the number of total items is active. Quote: if ($HTTP1/json/item/state/active = true()) then if ($HTTP1/json/item/state/acked = true()) then 'blue' else 'red' else 'black'
|
|
|
|
Rank: Administration
Groups: Registered, Administrators Joined: 7/21/2014(UTC) Posts: 487
Was thanked: 83 time(s) in 83 post(s)
|
This is because you are using XPath which always starts from the beginning of the tree. Within a repeating or dynamic table you are in a context of the element which was used to build the table. So, for example, if you have built your repeating table with element $HTTP1/json/item, then you should address the elements within this table with a relative path Code:
if (state/active = true()) then
if (state/acked = true()) then 'blue'
else
'red'
else
'black'
|
|
|
|
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.