function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Florian.GümbelFlorian.Gümbel 

Lightning component ui:modal not working

Hey there,

I tried to use to use the aura ui:modal component as it's described in the auradoc http://documentation.auraframework.org/auradocs#reference?descriptor=ui:modal&defType=component.

I included the panelManager2 component:
 
<ui:panelManager2 aura:id="pm">
    <aura:set attribute="registeredPanels">
        <ui:panel alias="panel"/>
        <ui:modal alias="modal"/>
    </aura:set>
  </ui:panelManager2>
createModal : function(component, event, helper){

        var
            body = $A.createComponent('aura:text', {value : 'TEST Content'}, function(a,b,c){}),
            footer = $A.createComponent('aura:text', {value : 'TEST Content'}, function(a,b,c){})
        ;

        $A.get('e.ui:createPanel').setParams({
            panelType   :'modal',
            visible: true,
            panelConfig : {
                title: 'Modal Header',
                body  : body,
                footer: footer
            },
            onCreate: function (panel) {
                //need this for event bubbling
                footer.setAttributeValueProvider(panel);
                console.log('createmodal ' + panel);
            }

        }).fire();
    }

Every time I call createModal, Lightning throws following error:
 
This page has an error. You might just need to refresh it.
Action failed: c:IssuePlacementsComponent$controller$createModal [Cannot read property 'setParams' of undefined]
Failing descriptor: {c:IssuePlacementsComponent$controller$createModal}

Seems like, 

$A.get('e.ui:createPanel')

fails...

Any ideas how to get this component working?

Thanks in advance and Cheers!

Flo
Lokesh KumarLokesh Kumar
HI Flo,

It seems like issue is with your property 'setParams' available could you please check where this being used in your code and check your working code by removing the ui:model and then include I don't think any error you will get in the above code.

Regards,
Lokesh
Florian.GümbelFlorian.Gümbel
Hi Lokesh,

thanks for your answer.

In my opinion the error source is that $A.get('e.ui:createPanel') returns undefined.
Undefined does not have properties, so this will fail.

It seems, that the modal component is currently not available in LEX..

Cheers
 
Lokesh KumarLokesh Kumar
HI FIo,

Kindly Check this link https://developer.salesforce.com/forums/?id=906F0000000g0q6IAA

Thanks!
Florian.GümbelFlorian.Gümbel

Hi Lokesh,

looks like a workaround :)
Thank you!

Cheers :)

Lokesh KumarLokesh Kumar
True !! you can try !!