Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/multithreading/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将值动态分配给Dojo';s对象_Dojo - Fatal编程技术网

如何将值动态分配给Dojo';s对象

如何将值动态分配给Dojo';s对象,dojo,Dojo,我正在尝试用Dojo实现TooltipDialog,虽然对话框显示得很好,但我仍然不知道如何更改提示的内容,我有如下代码: var _tipContent; require([ "dijit/TooltipDialog", "dijit/popup", "dojo/on", "dojo/dom", "dojo/domReady!" ], function (TooltipDialog, popup, on,

我正在尝试用Dojo实现TooltipDialog,虽然对话框显示得很好,但我仍然不知道如何更改提示的内容,我有如下代码:

var _tipContent;

require([
        "dijit/TooltipDialog",
        "dijit/popup",
        "dojo/on",
        "dojo/dom",
        "dojo/domReady!"
    ], function (TooltipDialog, popup, on, dom) {
        var myTooltipDialog = new TooltipDialog({
            id: 'myTooltipDialog',
            style: "width: 300px;",
            content: _tipContent,
            onMouseLeave: function () {
                popup.close(myTooltipDialog);
            }
        });

        on(dom.byId('TriggerBlock'), 'mouseover', function () {
            popup.open({
                popup: myTooltipDialog,
                around: dom.byId('TriggerBlock')
            });
        });
    });

function onMouseOverGraphics(sender, eventArgs) {
  _tipContent = "I wanna change the tip's content according to the current position, the x coordinate: " + eventArgs.clientX;

}

尝试使用以下方法:

dijit.showTooltip("This is the tool tip content",
     //this is the dom where you want the tooltip to show
     select.domNode,
     //this is an attribute to get where the tooltip of the dom
     select.get('tooltipPosition'),
     //this is the position or the side of where the tooltip will sho
     !select.isLeftToRight()
     );

myTooltipDialog.set(“content”,内容)
在您的情况下应该考虑变量范围。谢谢!它工作得很好。我想知道所有对象的方法是否可以使用“set”来赋值。我不太明白,但是你可以使用
widget.set('property',value)
来设置大多数属性。感谢你的回复,Krishna,我在官方网站的API参考中找不到这个方法,也许您的代码属于以前的版本,我正在使用1.9.1,我也在使用1.9.1,但有时如果您使用旧版本语法编写代码,它工作得很好,我想dojo开发人员会尽力让每个人都满意,即使是在新版本上。它可能已被弃用,但仍然有效。顺便说一句,我又读了你的问题,似乎我想了解你。您需要的是简单的,只需执行注册表.byId(“myTooltipDialog”).set(“内容”,“这是新内容”),当然,您需要在您的应用程序中添加
“dijit/registry”