Thread

Fluid display event

November 24, 2017 7:37am

Subscribe [3]
  • #1 / Nov 24, 2017 7:37am

    Reinos

    74 posts

    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.

  • #2 / Nov 27, 2017 1:34pm

    Seth Barber's avatar

    Seth Barber

    169 posts

    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?

  • #3 / Dec 12, 2017 7:23am

    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.

ExpressionEngine News

#eecms, #events, #releases