I cannot figure out why my reusable element has no data. Maybe I’m just misunderstanding the way it works, but it seems to be set up in a way that I would expect to work, so I would really appreciate some help here.
Basically, I have a reusable element which is set to hold a specific type of content called “Entrep Student Biz.”
I have added this reusable element to a popup on a specific page. I want to be able to click a button, show the popup, and have the reusable element display a bunch of data belonging to the current user.
To do this, I have a custom state called “Biz to view” on the popup itself with content type “Entrep student biz” - when I click the button, I am setting the “Biz to view” custom state of the popup to be the current user’s last “Entrep student biz” item.
I set the data source of the reusable element to be the same data source as the popup, i.e. the custom state called “Biz to view” which gets set. I have confirmed that the custom state is getting set correctly when the button is clicked, and there is data in the database which should appear.
However, none of the data actually displays in the reusable element. I cannot understand why this is the case. It seems pretty straightforward to me but I can’t get it to work.
Get the Data source field empty. Then add a conditional in your pop-up, when your pop-up ‘s custom state is not empty, Data source = pop-up’ s custom state.
When you close the pop-up, set the custom state to null.
That will force the data to update whenever the custom state changes.
Not sure if you may have misunderstood the problem… I’m not having trouble updating the data after closing the popup or whenever the custom state changes. I cannot get data to display in the reusable element AT ALL.
For whatever reason, setting the data source of the reusable element to be the popup’s custom state is not a viable way of getting it to work, and I can’t understand why.
What I tried to explain is that, as per my own experience, is : “sometimes”, if the data source is not initally empty then set on the fly using a conditional , the data don’t update.
I can’t explain why, but that’s what I observed when using reusable component. I used to encapsulate them in a group, set the data to the group via a state, a’d use a conditional in the reusable to refresh the data (set the data source) when the parent group’ state is not empty.
In your case, if you can’t display the data in the reusable, it means that the input data are empty, probably.
Ha… wow I feel dumb. Somehow I managed to create a second blank set of data (which apparently means there is a bug somewhere else I need to track down), and that’s why it was showing blank.