XPages and Twitter Bootstrap Modal not working when using SSJS -
it's pretty easy twitter bootstrap modal working in xpages following examples in site. however, doesn't seem work if want use ssjs affect contents of modal before gets displayed. seems flash, , shows background.
it seems problem using xpages full or partial refresh.
i've tried getting work "normally" , i've tried using jquery , remote service change in no luck.
below code remote service.
any examples on how affect or refresh modal contents prior showing dialog appreciated.
<?xml version="1.0" encoding="utf-8"?> <xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xc="http://www.ibm.com/xsp/custom" xmlns:xe="http://www.ibm.com/xsp/coreex"> <xc:layout_header></xc:layout_header> <xp:link escape="true" text="link" id="link1" value="#mymodal"> <xp:this.attrs> <xp:attr name="role" value="button"></xp:attr> <xp:attr name="data-toggle" value="modal"></xp:attr> </xp:this.attrs> </xp:link> <xp:br></xp:br> <xp:panel id="mypanel"> <xc:bs_modal idname="mymodal"> <xp:this.facets> <xp:panel xp:key="facet_1"> dialog <xp:br></xp:br> <xp:br></xp:br> time <xp:text escape="true" id="computedfield1" value="#{viewscope.vstime}"> <xp:this.converter> <xp:convertdatetime type="both"></xp:convertdatetime> </xp:this.converter> </xp:text> </xp:panel> </xp:this.facets> </xc:bs_modal> </xp:panel> <xp:br></xp:br> <xe:jsonrpcservice id="jsonrpcservice1" servicename="testservice"> <xe:this.methods> <xe:remotemethod name="settime"> <xe:this.script><![cdata[viewscope.put("vstime", @now())]]></xe:this.script> </xe:remotemethod> </xe:this.methods></xe:jsonrpcservice> <xp:br></xp:br> <xp:scriptblock id="scriptblock1"> <xp:this.value><![cdata[$('#mymodal').on('show', function () { testservice.settime(); var id = "#{id:mypanel}" xsp.partialrefreshget(id) })]]></xp:this.value> </xp:scriptblock></xp:view>
since integrates xpages, i'd use <xe:dialog>
extension library instead , modify (adding/ removing classes) make bootstrap modal.
here's sample code started:
<xe:dialog id="dialog1" title="dialog title" styleclass="modal" style="margin-left: inherit"> <xe:this.onshow> <![cdata[//make dialog bootstrap dialog using jquery magic //add modal-header class title bar var titlebar = $(".modal .dijitdialogtitlebar").addclass("modal-header"); //replace title node (by default it's span) var titlenode = $(".dijitdialogtitle", titlebar); var title = titlenode.text(); titlenode.remove(); //add class close icon $(".dijitdialogcloseicon", titlebar).removeclass("dijitdialogcloseicon").addclass("close"); //add new h3 node title titlebar.append("<h3>" + title + "</h3>"); ]]> </xe:this.onshow> <xe:dialogcontent id="dialogcontent1" styleclass="modal-body"> dialog content here </xe:dialogcontent> <xe:dialogbuttonbar id="dialogbuttonbar1" styleclass="modal-footer"> <xp:button value="close" id="button2"></xp:button> </xe:dialogbuttonbar> </xe:dialog>
Comments
Post a Comment