Unable to close and reopen Floating Panel in Dojox

橙三吉。 提交于 2019-12-13 04:52:23

问题


I am trying to open a floating panel, using onClick event, it opens fine but shows this error in the console, this.onClick is not a function.

If I close the floating panel and then try to a reopen, it won't open again and I keep receiving the same error in the console.

This is my application. You can see a floating panel emerge when you click on the Layers button in the toolbar.

This is the main function that is opening the FLoating Panel,

function addFloatingPanel() {
    var fp = new dojox.layout.FloatingPane({
        title: "Layers",
        resizeable: true,
        dockable: false,
        closable: true,
        style: "position:absolute; top:0; left:50px; width:245px; height: 175px; z-index: 100; visibility: hidden;",
        id: 'floater'
    }, dojo.byId('floater'));
    fp.startup();
    if (dojo.byId('floater').style.visibility === 'hidden') {
        dijit.byId('floater').show();
    } else {
        dojo.byId('floater').style.visibility = 'hidden'
        dijit.byId('floater').show();
    }
}

Where am I going wrong? Also, the floating panel is visible in firefox but not in chrome!!


回答1:


Needed to create the dojo.connect function

<div data-dojo-type="dijit.form.Button" id="searchTool" >Search</div>

for onclick event,

searchTl = dojo.byId('searchTool');
dojo.connect(searchTl, "onclick", openSrFp);

and add this function,

var fp = dojo.byId('floater');
            if (fp.style.visibility=="hidden") {
                fp.style.visibility="";
            } else {
                fp.style.visibility="hidden";
            }


来源:https://stackoverflow.com/questions/12548488/unable-to-close-and-reopen-floating-panel-in-dojox

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!