Dmx-show not working initially


#21

Page preloader would be an option, right. But not in this project.

I tried:

<!-- noDataFound -->
       <div class="row py-4" style="display:none" dmx-show="dvNews.data.hasItems()">
        <div class="col-md-9">
          <p>Es wurde kein Datensatz gefunden.</p>
        </div>
      </div>
        <!--/ noDataFound -->

Doesn’t work…


#22

This didn’t work for me because when dmx-show is triggered, it tries to set display:block, but the inline CSS of display:none doesn’t get overridden.
And, preloader would not help in this case either as the text would still be visible behind the preloader.
Solution given by @mrbdrm works perfectly.

@swf I think you missed the part where @mrbdrm suggested to use dmx-hide instead of dmx-show. And, use both the conditions - has items and executing.

dmx-hide=“dvNews.data.hasItems() || dvNews.state.executing”


#23

@nshkrsh Thanks for your support. I’ve tried this code, but it doesn’t work.


#24

I’ve also tired to add toggle class based on dmx-class:show="!dvNews.items", doesn’t work. I always see the nodata message flashing up for a moment …


#25

Can you share a link to your page?


#26

I’ve sent you a message with the link


#27

I see the data source set in repeat region is dvNews.data which is the data view component. I was assuming it was the server connect. :sweat_smile:
So try this to hide your no-data text:

dmx-hide=“scNews.data.repeatNews.hasItems() || scNews.state.executing”


#28

Nope, doesn’t work either. Also, I’m filtering the dataview, not the serverconnect. So the server connect might have records, but not the dataview.


#29

@nshkrsh code should work
use state.executing condition with the server connect you are loading the data with


#30

From the code I see, the filter is set on server connect.
<dmx-serverconnect id="scNews" url="../dmxConnect/api/xxx.php" dmx-param:category="filter.value"></dmx-serverconnect>

You can try to put server connect tags at the top of the page instead of end.

I have the same setup and it works fine. You can try here:
https://demo.slashash.co/logistics/tracking.php?track=789456AC
This link will load data.

https://demo.slashash.co/logistics/tracking.php?track=789456AB
This link will load not found message


#31

I’ve changed the postion of the server connect, didn’t help … arghhh


#32

It seems to we working now. I don’t see the no-data text anymore.
Try opening your page in incognito.


#33

Still see it in icongnito and FF, but not in Safari.


#34

wekk you want to hide the region when 3 conditions are valid:

  1. data is not loaded yet
  2. you have items
  3. data is being loaded

according to Patrick - hasItems() returns undefined/true/false - not loaded, has items or no items (but loaded),

so you can do it in one, with strict checks, show only when there are really no items, otherwise hide:

dmx-show="scNews.data.repeatNews.hasItems() === false"

very important the 3 === for strict checks


#35

Thanks George, that solved the problem!