I'm trying to create a custom text-area in admin panel and I need to attach the afterRender event to it.

Config XML:

<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    <fieldset name="behavior">
        <field name="behavior_field_feed_template">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="label" xsi:type="string" translate="true">Feed Template</item>
                    <item name="visible" xsi:type="boolean">true</item>
                    <item name="dataType" xsi:type="string">text</item>
                    <item name="formElement" xsi:type="string">textarea</item>
                    <item name="component" xsi:type="string">Feeds/js/form/export-feed-template</item>
                    <item name="source" xsi:type="string">export</item>
                    <item name="sortOrder" xsi:type="number">20</item>
                    <item name="dataScope" xsi:type="string">behavior_field_feed_template</item>
                    <item name="imports" xsi:type="array">
                        <item name="toggleVisibility" xsi:type="string">${$.parentName}.behavior_field_file_format:value</item>
                    <item name="valuesForOptions" xsi:type="array">
                        <item name="feeds_product" xsi:type="string">feeds_product</item>
                    <item name="notice" xsi:type="string">
                        To generate Feed you need to prepare template.
                        You can do this with existing templates which we've prepared for you or can create your own.


    function (Element, CodeMirror) {
        'use strict';

        return Element.extend(
                defaults: {
                    valuesForOptions: [],
                    isShown: false,
                    inverseVisibility: false,
                    visible: false

                afterRender: function() {
                    // Do something here!!!

What setting I'm I missing to achieve this? Thanks


So. All I had to do is to add 1 line into config: Feeds/form/template Then add this template into dir and add the "afterRender: afterRender" config into data-bind.

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.