how to run CSJS on xe:dialog when it isloaded?

88 Views Asked by At

I want to run some CSJS on the content of a xe:dialog after it is being loaded. I can not find an event for it.

How can I do this?

2

There are 2 best solutions below

2
Per Henrik Lausten On

You can use the onLoad event of xe:dialog. Here's an example that prints to the console when the dialog is opened:

<xp:button id="test" value="Test dialog">
    <xp:eventHandler event="onclick" submit="false">
        <xp:this.script><![CDATA[XSP.openDialog('#{id:testDialog}')]]></xp:this.script>
    </xp:eventHandler>
</xp:button>

<xe:dialog id="testDialog" title="Test" onLoad="console.log('Test')">
    <xp:div styleClass="lotusDialogContent">

    </xp:div>
    <div class="lotusDialogFooter">
        <xp:link id="link1" text="Cancel" styleClass="lotusAction">
            <xp:eventHandler event="onclick" submit="false">
                <xp:this.script><![CDATA[XSP.closeDialog('#{id:testDialog}')]]></xp:this.script>
            </xp:eventHandler>
        </xp:link>
    </div>
</xe:dialog>
0
Patrick Kwinten On

onFocus events works when... autoFocus is not disabled

<xe:this.dojoAttributes>
<xp:dojoAttribute name="autofocus" value="false">
</xp:dojoAttribute>
</xe:this.dojoAttributes>