Skip to main content

I have a 3 separate field editors that have only template fields and is attached to a model. The template fields are populated by an inline JavaScript and I want to conditionally render each field editor.

When the field editors don’t have a render condition on them all the data shows properly. Once I conditionally render the field editors the data does not appear. I checked the console and all the data loads on page load and model query so the data is there but I don’t understand why it is not showing. 


Here is the code handling the page load and refresh


$(document.body).one('pageload', function() {&nbsp; &nbsp; &nbsp; &nbsp; updateTemplateFields();<br>&nbsp; &nbsp; });<br>&nbsp; &nbsp; skuid.events.subscribe('models.loaded', function(updateResult) {<br>&nbsp; &nbsp; &nbsp; &nbsp; if (updateResult.models.BillableDays) &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;updateTemplateFields(); //Displays result on requery<br>&nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; });<br>})(skuid);



What does your conditional rendering statement look like?  If the data is there - I’d look there.  If the field editors show when the JS is run without conditional rendering,  then the rendering is your suspect. 

You could also do your coniditional rendering in your JS and only Render the component that makes sense for the use case at hand… 


Rob,

Thanks for pointing me in the right direction. For whatever reason just the model query in the actions of my button was not enough to refresh the data, it needed  second refresh. So I added a action on the model that whenever it is refreshed (which happens through the button I created) the model will refresh again. That did the trick the data shows properly.

I am not sure if this is a bug or intended use but if you need more info just let me know.