3

In Magento 2 we are executing data-mage-init and x-magento-init in dynamic content (ajax response) using using contentUpdated:

<script type=“text/x-magento-init”>
    {
        "*": {
            "Magento_Ui/js/core/app": {
                "components": {
                        "messages": {
                            "component": "Magento_Theme/js/view/messages"
                        }
                    }
                }
            }
    }
</script>

container.trigger('contentUpdated')

I need trigger another callback function after contentUpdated event. Anybody know any callback method for this?

0

Why do you not want to use a standard event?

container.on(
    'contentUpdated',
    yourCallbackFunctionGoesHere()
);

container.trigger('contentUpdated');
  • Thanks for the reply. I already tried but not working. I need to change options of a plugin which was executed in contentUpdated event. – Anjith K P Dec 8 '17 at 12:26
  • @AnjithKP Could you be more specific, what exactly do you want to change and where? – Siarhey Uchukhlebau Dec 8 '17 at 12:31
  • I need to open some items in accordion after ajax call is made. When I tried that above, its showing that you can not use the accordion plugin before initializing. – Anjith K P Dec 8 '17 at 13:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.