App Connect State Management Support Product Page
Answered
populate dmx-value id with a conditional value
Asked 26 Jun 2018 09:06:36
1
has this question
26 Jun 2018 09:06:36 Dik Hendriks posted:
I have a page with a news item list and corresponding detail region. The detail region should be populated in one of two ways.Depending on a url-parameter, or when this parameter is empty, the first item in de items list.
The id variable with the url parameter.
<dmx-value id="idd" dmx-bind:value="query.item_id"></dmx-value>
The same id variable with the first item in the list.
<dmx-value id="idd" dmx-bind:value="lijst.data.newsListQ[0].ItemID"></dmx-value>
Is this possible?
Replies
Replied 26 Jun 2018 09:10:34
26 Jun 2018 09:10:34 Teodor Kuduschiev replied:
Hi Dik,
You can try doing this:
<dmx-value id="idd" dmx-bind:value="query.item_id || lijst.data.newsListQ[0].ItemID"></dmx-value>
You can try doing this:
<dmx-value id="idd" dmx-bind:value="query.item_id || lijst.data.newsListQ[0].ItemID"></dmx-value>
Replied 29 Jun 2018 08:26:38
29 Jun 2018 08:26:38 Dik Hendriks replied:
Thanx Theodor,
I also found another solution;
Using the formatter option 'default'.
<dmx-value id="idd" dmx-bind:value="query.item_id.default(lijst.data.newsListQ[0].ItemID)"></dmx-value>
I also found another solution;
Using the formatter option 'default'.
<dmx-value id="idd" dmx-bind:value="query.item_id.default(lijst.data.newsListQ[0].ItemID)"></dmx-value>
Replied 29 Jun 2018 08:28:33
29 Jun 2018 08:28:33 Teodor Kuduschiev replied:
Yes, this one is a much nicer solution