【问题标题】:dojo ignores element when parent div syle display none当父 div 样式显示无时 dojo 忽略元素
【发布时间】:2012-10-16 01:24:57
【问题描述】:

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

我尝试隐藏可见性,但是 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 输出)

在道场“渲染”之后,它看起来像这样:

<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>

佩佩 + 生长 + 飓风 +

【问题讨论】:

  • 如果其他主题不相关,请勿标记它们。参考jquery。
  • 它实际上是 jquery 我使用的弹出插件制作了一个 ifream - 如果你问我很奇怪
  • 如果你能提供一个托管它的示例页面,我会看看。

标签: dojo


【解决方案1】:

如果所有元素都在具有主题集的&lt;body&gt; 标记内,它们都将获得Dojo 样式。

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

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

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

【讨论】:

  • 我遇到了解析器,问题是我用相同的 id 调用了 1 个对象两次,但我现在修复了它,它是 dojo 样式,但它只显示了 1 个选项
  • 您也可以指定要解析的节点。 parser.parse("elementId")
猜你喜欢
  • 2015-06-05
  • 1970-01-01
  • 1970-01-01
  • 2014-03-29
  • 1970-01-01
  • 2013-10-17
  • 1970-01-01
  • 2010-10-31
  • 2022-11-23
相关资源
最近更新 更多