I am using ALLOY DIALOG in Liferay 6.0.5 as follows:
function countPopup(){
AUI().use('aui-dialog', 'liferay-portlet-url', function(A) {
var dialog = new A.Dialog({
title: 'Upload Details',
centered: true,
modal: true,
width: 500,
height: 400,
bodyContent:"testing",
}).render();
});
}
I am getting in popup " testing ". But Instead of "bodycontent" I want to forward to one jsp file where i have written some logic. How to do that?
You must "plug" another module to feed a.Dialog with article desired.
Try some like this:
AUI().use('aui-dialog', 'aui-io', function(A) {
var dialog = new A.Dialog({
title: 'Upload Details',
centered: true,
modal: true,
width: 500,
height: 400,
}).plug(A.Plugin.IO, {uri: 'your_url.html'}).render();
});
I know this is too much late to give answer to this question but here is the solution.
<%
User selUser = (User)request.getAttribute("user.selUser");
PortletURL popupURL = renderResponse.createRenderURL();
popupURL.setWindowState(LiferayWindowState.POP_UP);
popupURL.setParameter("jspPage","Your jsp page path here");
String popup = "javascript:xyzPopUp('"+ popupURL.toString() + "');";%>
<aui:script>
Liferay.provide(
window,
'xyzPopUp',
function(url) {
var A = AUI();
var portletURL="<%=themeDisplay.getURLManageSiteMemberships().toString()%>";
var dialog = new A.Dialog(
{
modal: true,
centered: true,
destroyOnClose: true,
draggable: true,
height: 150,
resizable: false,
title: 'your title here',
width: 200
}
).plug(
A.Plugin.IO,
{
uri:url
}
).render();
},
['aui-dialog']
);
</aui:script>
This will open the given jsp page in to popup.
Related
I am unable to add an existing object to my game
function create() {
const scene: Phaser.Scene = this
// scene.physics.add.image(400, 100, 'ball') THIS WORKS => BALL APEARS IN GAME
const ball = new Phaser.GameObjects.Image(scene, 400, 100, 'ball')
scene.physics.add.existing(ball) // nothing displays
}
What am I missing out on ?
I had the same problem, but then discovered I had to add it to both the scene and the physics manager, such as:
const ball = new Phaser.Physics.Arcade.Sprite(scene, 400, 100, 'ball');
this.add.existing(ball);
this.physics.add.existing(ball);
var config = {
width: 800,
height: 600,
type: Phaser.AUTO,
loader: {
baseURL: 'https://raw.githubusercontent.com/nazimboudeffa/assets/master/',
crossOrigin: 'anonymous'
},
parent: 'phaser-example',
physics: {
default: 'arcade'
},
scene: {
preload: preload,
create: create
}
};
var game = new Phaser.Game(config);
function preload()
{
this.load.image('dude', 'sprites/phaser-dude.png')
}
function create ()
{
var dude = new Phaser.GameObjects.Sprite(this, 100, 100, 'dude')
this.add.existing(dude)
}
<script src="//cdn.jsdelivr.net/npm/phaser#3.17.0/dist/phaser.min.js"></script>
I am trying to show attribute of wfs gml layer from geoserver as label in my openlayer3 application. I am successful to get label as text but unable to access the particular attribute 'name'. Given is the code I am working with.
var sourceWFS = new ol.source.Vector({
loader: function (extent) {
$.ajax('..../geoserver/harry/ows?', {
type: 'GET',
data: {
service: 'WFS',
version: '1.1.0',
request: 'GetFeature',
typename: 'ABC',
srsname: 'EPSG:3857',
geometryField:'geometry',
bbox: extent.join(',') + ',EPSG:3857'
}
}).done(function (response) {
sourceWFS.addFeatures(formatWFS.readFeatures(response));
});
},
strategy: ol.loadingstrategy.tile(ol.tilegrid.createXYZ()),
strategy: ol.loadingstrategy.bbox,
projection: 'EPSG:3857',
});
var layerWFS = new ol.layer.Vector({
source: sourceWFS
});
var interaction;
var interactionSelectPointerMove = new ol.interaction.Select({
condition: ol.events.condition.pointerMove
});
var interactionSelect = new ol.interaction.Select({
style: new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'rgba(255,0,0,1.0)',
width: 1
}),
fill: new ol.style.Fill({
color: 'rgba(255,0,0,0.5)'
}),
text: new ol.style.Text({
text:("abcd")
})
})
});
var interactionSnap = new ol.interaction.Snap({
source: layerWFS.getSource()
});
I am getting abcd as label on selection
You will need a style function to set the text in the style from whichever feature property you wish to display
var selectStyle = new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'rgba(255,0,0,1.0)',
width: 1
}),
fill: new ol.style.Fill({
color: 'rgba(255,0,0,0.5)'
}),
text: new ol.style.Text({
text:("abcd")
})
});
var interactionSelect = new ol.interaction.Select({
style: function(feature) {
selectStyle.getText().setText(feature.get('name'));
return selectStyle;
}
});
You will not get any attribute that is "hidden" by a GML attribute by default. The most common "missing" attributes are name and id. You can turn off this (standard complying) behaviour by checking the Override GML Attributes in the WFS services page for the version of GML your client is requesting.
What you are actually displaying is the "abcd" string itself and not the value of "abcd" property.
To access some feature property value in an ol.Style you must use a StyleFunction as follows :
style: function(feature, resolution){
return new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'rgba(255,0,0,1.0)',
width: 1
}),
fill: new ol.style.Fill({
color: 'rgba(255,0,0,0.5)'
}),
text: new ol.style.Text({
text: feature.get("abcd");
})
})
}
Hi can We call one JS file from one file to another file...Means multiple JS files. I have one panel in JS like this and if I called another JS file ,that should read this PANEL control values.
You can use one js file content in to another js file. Use use like this
//file1.js
var tabs = Ext.createWidget('tabpanel', {
cls: "auto-width-tab-strip",
activeTab: 0,
plain: true,
autoHeight: true,
defaults: {
autoHeight: true,
style: 'min-height:620px; padding:10px;'
},
items: [{
title: 'tab1',
loader: {
url: 'tab1.jsp',
scripts: true,
loadMask: true
}
}]
});
function myFirstFun(){
something
......
......
}
//End of file1.js
You can reuse the above code Some where like this
//file2.js
var panel = Ext.create('Ext.panel.Panel', {
title: 'Forum Search',
height: 300,
width: 600,
renderTo: 'search-panel',
id: 'search-results',
layout: 'fit',
items: tabs
});
Ext.get('someid').on('click', function(){
myFirstFun();
});
//End of file2.js
Like this you can call the file1.js function in to file2.js, But you have include both js files in your html page.
I think this may help you.
I need a YUI3 tabview like
<div id="demo"></div>
<script>
YUI().use('tabview', function(Y) {
var tabview = new Y.TabView({
children: [{
label: 'foo',
content: '<p>foo content</p>'
}, {
label: 'bar',
content: '<p>bar content</p>'
}, {
label: 'baz',
content: '<p>baz content</p>'
}]
});
tabview.render('#demo');
});
</script>
Now need a event handler which will be of following specification
It will be fired when user will click on tab something like "selectedTabChanged"
Inside the handler will determine the label of the "SelectedTab"
Just add this below tabview.render('#demo');
tabview.on('selectionChange', function (e) {
alert('Changing tab from "' + e.prevVal.get('label') + '" to "' + e.newVal.get('label') + '"');
}
I'm creating a dialog with YAHOO.widget.Dialog. The dialog is fired off by clicking on a link, and the function the link uses specifies parameters that finally get added to a postdata option like so:
var myDialog = new YAHOO.widget.Dialog("myDialog", {
fixedcenter: true,
// postmethod: "form",
postdata: propString
});
This works just fine, but now I need to do the same thing but using "form" instead of "async" - and there's no postdata for form submissions.
What's the right way to do this?
(YUI 2.7.0)
Here is an example:
var dlg= new YAHOO.widget.Dialog("objectDlg",{
close: false,
draggable: false,
hideaftersubmit: false,
modal: true,
fixedcenter: true,
visible: false,
constraintoviewport: true,
dataURL: saveObjectURL,
buttons: [{'text': 'Save',handler: function(){
var postdata= ...
this.cfg.setProperty("postdata", postdata); //this is important
this.submit();}, 'isDefault': false},
{'text': 'Cancel', handler: function() {this.cancel();}, 'isDefault': true}] });
dlg.render(document.body);
Hope it is helpful