当父div样式显示none时,dojo忽略元素

时间:2012-10-25 19:23:36

标签: dojo

我的选择是在一个div元素中,它具有样式属性display:none,因为它只显示在一个弹出窗口中,dojo忽略这些并且我看到一个正常的html选择但弹出窗口外面的相同3行显示了一个完美的dijit选择形式

我试过隐藏了visiblility,但是jquery的bpupop插件无法显示div

<select name="ToServer" id="ToServer" data-dojo-type="dijit/form/Select">
    <option value="1" label="breitseite">breitseite</option>
    <option value="2" label="pepe">pepe</option>
    <option value="3" label="grow">grow</option>
    <option value="4" label="hurricane">hurricane</option>
</select>

任何想法我做错了什么或者如何在弹出窗口打开时强制dojo重新设置div

更新 我有解析器的问题是我用相同的id调用了1个对象两次,但我现在修复了它的dojo风格,但它只显示了我选择的1个选项(相同的html输出)

在dojo“渲染”后,它看起来像:

<table class="dijit dijitReset dijitInline dijitLeft dijitDownArrowButton dijitSelect dijitValidationTextBox" data-dojo-attach-point="_buttonNode,tableNode,focusNode" cellspacing="0" cellpadding="0" role="listbox" aria-haspopup="true" tabindex="0" id="ToServer" widgetid="ToServer" aria-expanded="false" aria-invalid="false"><tbody role="presentation"><tr role="presentation"><td class="dijitReset dijitStretch dijitButtonContents" role="presentation"><div class="dijitReset dijitInputField dijitButtonText" data-dojo-attach-point="containerNode,_popupStateNode" role="presentation" popupactive="true"><span role="option" class="dijitReset dijitInline dijitSelectLabel dijitValidationTextBoxLabel ">breitseite</span></div><div class="dijitReset dijitValidationContainer"><input class="dijitReset dijitInputField dijitValidationIcon dijitValidationInner" value="? " type="text" tabindex="-1" readonly="readonly" role="presentation"></div><input type="hidden" name="ToServer" data-dojo-attach-point="valueNode" value="1" aria-hidden="true"></td><td class="dijitReset dijitRight dijitButtonNode dijitArrowButton dijitDownArrowButton dijitArrowButtonContainer" data-dojo-attach-point="titleNode" role="presentation"><input class="dijitReset dijitInputField dijitArrowButtonInner" value="? " type="text" tabindex="-1" readonly="readonly" role="presentation"></td></tr></tbody></table></dd></div><div class="dijitPopup dijitMenuPopup" style="visibility: visible; top: 174px; z-index: 1000; right: auto; left: 619px; display: none; " role="presentation" id="ToServer_dropdown" dijitpopupparent="ToServer"><div style="overflow: visible; top: 0px; width: 67px; visibility: visible; " class="dijit dijitMenu dijitReset dijitSelectMenu dijitValidationTextBoxMenu dijitMenuPassive" role="presentation" id="ToServer_menu" widgetid="ToServer_menu" tabindex="0"><table class="dijitReset dijitMenuTable" role="listbox" tabindex="0" data-dojo-attach-event="onkeypress:_onKeyPress" cellspacing="0" style="">
<tbody class="dijitReset" data-dojo-attach-point="containerNode"><tr class="dijitReset dijitSelectSelectedOption dijitValidationTextBoxSelectedOption dijitMenuItemSelected dijitMenuItem" data-dojo-attach-point="focusNode" role="option" tabindex="-1" aria-labelledby="dijit_MenuItem_0_text dijit_MenuItem_0_accel" id="dijit_MenuItem_0" aria-disabled="false" widgetid="dijit_MenuItem_0" aria-selected="true">
<td class="dijitReset dijitMenuItemIconCell" role="presentation">
    <img src="//ajax.googleapis.com/ajax/libs/dojo/1.8.0/dojo/resources/blank.gif" alt="" class="dijitIcon dijitMenuItemIcon dijitNoIcon" data-dojo-attach-point="iconNode">
</td>
<td class="dijitReset dijitMenuItemLabel" colspan="2" data-dojo-attach-point="containerNode" id="dijit_MenuItem_0_text">breitseite</td>
<td class="dijitReset dijitMenuItemAccelKey" style="display: none" data-dojo-attach-point="accelKeyNode" id="dijit_MenuItem_0_accel"></td>
<td class="dijitReset dijitMenuArrowCell" role="presentation">
    <div data-dojo-attach-point="arrowWrapper" style="visibility: hidden">
        <img src="//ajax.googleapis.com/ajax/libs/dojo/1.8.0/dojo/resources/blank.gif" alt="" class="dijitMenuExpand">
        <span class="dijitMenuExpandA11y">+</span>
    </div>
</td>

                       佩佩                                             +                                      增长                                             +                                      飓风                                             +              

1 个答案:

答案 0 :(得分:1)

如果所有元素都在具有主题集的<body>标记内,则它们将获得Dojo样式。

您的问题实际上不是样式,但最有可能与解析有关。我建议你的dijit/form/Select没有被解析。

您可以通过从控制台运行来确认:

require(["dojo/parser"], function(parser){
  parser.parse();
});