is there a way that we can query the FM object to return the container property that was used to initialize it, or return the associated HTML DOM element ?
thank you,
stay safe
Hello, Michael!
Thank you for writing to us.
Our team wants to inform you that there is a way to reach the container of Flexmonster component from the Toolbar.
You need to enable the Toolbar and use the flexmonster.toolbar.pivotContainer
property to get the desired DOM element.
We have prepared a simple example for visualization: https://jsfiddle.net/flexmonster/9tdgkq6z/.
Please let us know if it helps.
Regards,
Solomiia.
Thank you.
If possible, I think it would be lovely if one was able to get the pivotContainer regardless of whether or not the toolbar is enabled.
(It can make code more elegant when integrating FM)
Best,
M
Hello, Michael!
Thank you for your quick response.
Our team wants to ask you for more details about your use case:
1. Do you use any framework in your project?
2. In which way do you embed Flexmonster in your HTML page without directly using the id of the container element?
This information would greatly help us.
Looking forward to hearing from you.
Best regards,
Solomiia.
Thank you.
I'm just using plain javascript.
Looking to have javascript functions that can manipulate e.g. display: none etc. to the container.
Particularly for multi-FM pages, I keep a variable for each fmObject and fmContainer to be able to reference the flexmonster object and the container holding it.
It would be a nice simplification to allow just keeping a single variable instead. (the fmObject) and have it be able to tell me what the container is, without requiring the toolbar enabled.
Hope this helps!
Thank you,
Hello, Michael!
Thank you for the detailed explanation of your case.
We want to suggest keeping only one variable for each pivot - the container id.
Then, you can query this container and get the Flexmonster API like follows:
const flexmonsterAPI = document.getElementById("flexmonsterContainer") .uielement.flexmonster;
You can read more about this approach in our docs: https://www.flexmonster.com/api/new-flexmonster/.
Kindly note this feature is available from the 2.8.31
version of Flexmonster.
Here is our upgrading to the latest version guide, if needed: https://www.flexmonster.com/doc/updating-to-the-latest-version/.
We hope it helps. Feel free to ask if any further questions arise.
Regards,
Solomiia.
Hello, Michael!
Hope you are having a great week.
Our team is wondering if you had a chance to try the suggested approach and get Flexmonster reference from the container. Could you please let us know if our response helped?
Looking forward to hearing from you.
Regards,
Solomiia.
Hello, Michael!
Hope you are doing well.
Just checking in to ask if our approach helped you get Flexmonster reference from the container.
We will be glad to hear your feedback.
Regards,
Solomiia
Thank you. this works.
Hello, Michael!
Thank you for your feedback.
We are happy to hear that our approach works for your case.
Feel free ask if any further questions arise.
Regards,
Solomiia