1

Using the below method to attempt to load a uicomponent over ajax into a tab within custom admin page shows a loading spinner which never completely loads.

loading ui component

XML for controller added buttons to the initial ui element

<referenceBlock name="ticketingo_ticket_form">
    <block class="Harrigo\Ticketingo\Block\Adminhtml\Ticket\Edit\Tab\Comments" name="ticketingo_ticket_form_comments" >
            <action method="setTabLabel">
            <argument name="label" xsi:type="string">Comments</argument>
        </action>
    </block>
</referenceBlock>

Block code for tab button

...
public function getTabUrl()
{
    return $this->getUrl('tickets/comment/viewcommentstab', ['_current' => true]);
}

public function isAjaxLoaded()
{
    return true;
}
...

Controller for uicomponent (Button points to this controller)

...
    public function execute()
    {
        $this->_view->loadLayout();
        $this->_view->renderLayout();
    }
...

Layout declares the ui component (This layout is then pulled over ajax)

<?xml version="1.0"?>
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <container name="content" label="Root">
        <uiComponent name="custommodule_ui_component"/>
    </container>
</layout>

This starts to load the uicomponent fine however spinner remains spinning indefinitely.

I've attempted running quick fixes like below:

https://github.com/magento/magento2/issues/9885

Not sure what the scope name is have used the same as within data-bind="scope: 'ticketingo_ticket_comments.ticketingo_ticket_comments'" on the ui component markup however this does not seem to work for me and issue remains.

require(['jquery', 'uiRegistry'], function ($, reg) {
    reg.remove('ticketingo_ticket_comments.ticketingo_ticket_comments'); 
    $('#container').trigger('contentUpdated'); 
    $('#container').applyBindings();
});

The ui componenets load fine if added into the main xml for the controller however I have not modified these for tabs and they remain the same, I've just moved into the tabs.

Within the core customer edit page <insertListing> seems to be being used where elements are loaded via ajax. Looks like i may need to use this method but not quite sure how it is used yet as cannot see much documentation on how to use this and cant quite work out what is required from the core. Similar question below however answer seems a little to vague on how to get insert listing to work.

Magento 2 form ui component ajax fieldset

  • Facing same issue. Did you find any solution ? – Yogesh Nov 8 at 10:32
  • Sorry afraid now. Parked it for now was going to do a custom way but really wanted a Magento method. If you make any progress let me know am gonna give another go soon. – harri Nov 8 at 10:36

Your Answer

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

Browse other questions tagged or ask your own question.