DMXzone App Connect Support Product Page

show element when repeat is empty

7 years ago Hans Haverlach posted:
I've a (nested) repeat with a filter on it:

dmx-repeat:showparents="sv_parents.data.q_tsoparents.where(`obo_obopties`, oo_id, "==")">


Sometimes the filter gives the repeat no data to show. In that case I want to show a div with a message.
I tried the dynamic attribute to show or hide. But in the WHEN field you cannot put something like: showparents: hasitems or something like that, like you can with a server connect query.

Is there a solution for this?

Replies

Replied 7 years ago
7 years ago Teodor Kuduschiev replied:
Replied 7 years ago
7 years ago Hans Haverlach replied:
Hi Teodor,

Yes I've seen that movie already. And it is clear, but not for above situation.
The 'Has items' condition only can be chosen with queries.

Look at my code above: the repeater takes data from the query (q_tsoparents) (and receives data, so it has items!).
But then the repeater itself has a filter: .where(`obo_obopties`, oo_id, "==&quot.
This filter sometimes returns data, sometimes not.
And here I want to use the show or hide dynamic attributes. But that seems not to be possible, since it is not the query that contains no items, but the repeater.
Replied 7 years ago
7 years ago Teodor Kuduschiev replied:
Well, then just use nested repeat regions in the server action instead.
Replied 7 years ago
7 years ago Hans Haverlach replied:
Ah yes, sometimes I'm to focused on the App connect section. The server actions provide many functions too. I'll try.
Thank you for pointing this out Teodor.
Replied 7 years ago
7 years ago Teodor Kuduschiev replied:
Here's a tutorial about nesting queries: www.dmxzone.com/go/32997/nesting-database-queries

Reply to this topic