Calling primefaces dialog using external javascript

Posted: November 18, 2013 in web

You can see this “PrimeFaces.cw” on inspect element if you just put modalAdDialog.show(); after on ready.

exernal js

$(function() {
	PrimeFaces.cw('Dialog', 'modalAdDialog', {
		id : 'login-page:modalDialog',
		modal : true,
		width : 450,
		height : 100
	});
        modalAdDialog.show();
	$('body').append('<div class="ui-widget-overlay" style="width: '+$(window).width()+'px; height: '+$(window).height()+'px; z-index: 1000;"></div>');  //this is for the modal overlay
});

xhtml

<p:dialog id="modalDialog" width="450" header="Mobile App"
				widgetVar="modalAdDialog" modal="true" height="100">
				<div>
					some text
				</div>
<p:commandButton type="button"
					onclick="$('.ui-widget-overlay').hide();modalAdDialog.hide()"
					value="No Thanks" />
			</p:dialog>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s