DMXzone App Connect Support Product Page
show element when repeat is empty
Reported 7 years ago
2
have this problem
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:
Hello Hans,
Please check this video: www.dmxzone.com/go/32811/show-or-hide-elements-on-your-page-when-a-query-returns-no-results
Please check this video: www.dmxzone.com/go/32811/show-or-hide-elements-on-your-page-when-a-query-returns-no-results
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, "=="
.
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.
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, "=="

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.
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