Dojo Digit Dialog. Is it possible?

I want to place a Dojo Dijit Dialog relative to one of my html elements. Is it possible? If yes. How?

currently, it always displays a dialog in the middle of the viewport.

Can someone help me on this?

Thanks.

amar4kintu

+4
source share
4 answers

I did this by setting the absolute default position of dijit.dialog using dojo ..

I used the following code to adjust the absolute position of the dialog to what I want.

dijit.byId('dialog').show(); dojo.style('dialog','background-color','#AAAAAA'); var co = dojo.coords('period'); // element below which I want to display dialog dojo.style('md1','top',(co.y + 25)+'px'); dojo.style('md1','left', co.x+'px'); 

Hope this helps someone.

Thanks.

amar4kintu

+2
source

Another way I do this (it doesn't matter, because I override the private method, but it gives me the flexibility I want):

 var d = new Dialog({ title:"Your Dialog", _position:function(){ if(this.refNode){ p = Geo.position(this.refNode); Style.set(this.domNode,{left:px + "px", top:py + "px"}); } }, showAround:function(node){ this.refNode = node; this.show(); } }); d.showAround(dojo.byId("someNode")); 

This example uses "dojo / dom-style" as a style and "dojo / dom-geometry" as a Geo.

+4
source

I think dijit.TooltipDialog is what you need.

+1
source
  var dialog = new dijit.Dialog({ title: myTitle, content: myDialogContent, style: "width: 300px;", onShow: function() { dojo.style(this.containerNode.parentNode,'visibility','hidden'); }, onLoad: function() { dojo.style(this.containerNode.parentNode,{top:'100px', visibility:'visible'}); } }); 

Instead of top: '100px', you can also use top: '20% ', but not well tested. My dojo is 1.7.1.

+1
source

Source: https://habr.com/ru/post/1304450/


All Articles