We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Fluid display event

Developer Preview

Reinos's avatar
Reinos
79 posts
7 years ago
Reinos's avatar Reinos

For Grid there is an event when an element is shown display and in Fluid we got add. For Fluid the add is fired when you add a new event and for Grid the display event is fired when the field got displayed (can be a new one or existing). For Fluid i miss a event when exisisting elements are displayed on the page.

Is it possible to add a display like event for Fluid? This way we can check when we need to init JS functions to an element and we can keep the code in just one place.

       
Seth Barber's avatar
Seth Barber
172 posts
7 years ago
Seth Barber's avatar Seth Barber

We talked about adding a display event for Fluid fields but quickly realized they aren’t displayed like Grid. When the publish form renders a Fluid field it goes through all its existing fields and asks each one to render itself then compiles those results as its render. So, all the displaying is happening in PHP and not JS, so a display event would be equivalent to a document ready event. What we noticed in our testing was that fields that rendered fine outside of a Fluid field also rendered fine within one, and didn’t need additional JS events for initialization. Can you tell me what you are looking to do on display while inside a Fluid field?

       
Ben @PutYourLightsOn's avatar
Ben @PutYourLightsOn
295 posts
7 years ago
Ben @PutYourLightsOn's avatar Ben @PutYourLightsOn

Thanks for the explanation Seth. I’m also missing a display event for Fluid fields, but the more I look at my Fieldtype class code, the more I think I need to refactor my code to be more modular and to therefore work with the standard display_field method. Will give it a shot and report back here if I come across any issues.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.