2010-11-12 90 views
0

我想在之前和此之後插入一個標籤,我剛剛創建了dojo filteringSelect小部件標籤。我怎麼能在道場做到這一點?在dojo過濾之前和之後添加span標籤SelectWidget

<html> 
<head> 
    <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.3/dojo/dojo.xd.js"> 
    </script> 
    <script type="text/javascript"> 
     dojo.require("dijit.form.FilteringSelect"); 
     var filteringSelect = new dijit.form.FilteringSelect({ 
      id: "test" 
     }, "test"); 
    </script> 
    /> 
</head> 
<body> 
    <div aria-expanded="false" widgetid="test" role="combobox" class="dijit dijitReset dijitInlineTable dijitLeft dijitComboBox" id="widget_test" dojoattachevent="onmouseenter:_onMouse,onmouseleave:_onMouse,onmousedown:_onMouse" dojoattachpoint="comboNode" wairole="combobox" tabindex="-1"> 
     <div style="overflow: hidden;"> 
      <div role="presentation" class="dijitReset dijitRight dijitButtonNode dijitArrowButton dijitDownArrowButton dijitArrowButtonActive" dojoattachpoint="downArrowNode" wairole="presentation" dojoattachevent="onmousedown:_onArrowMouseDown,onmouseup:_onMouse,onmouseenter:_onMouse,onmouseleave:_onMouse"> 
       <div class="dijitArrowButtonInner"> 
        ? 
       </div> 
       <div class="dijitArrowButtonChar"> 
        ? 
       </div> 
      </div> 
      <div class="dijitReset dijitValidationIcon"> 
       <br> 
      </div> 
      <div class="dijitReset dijitValidationIconText"> 
       ? 
      </div> 
      <div class="dijitReset dijitInputField"> 
       <input aria-owns="test_popup" value="United States" aria-required="true" tabindex="0" id="test" aria-invalid="false" aria-autocomplete="list" aria-haspopup="true" role="textbox" autocomplete="off" class="dijitReset" dojoattachevent="onkeypress:_onKeyPress,compositionend" dojoattachpoint="textbox,focusNode" wairole="textbox" waistate="haspopup-true,autocomplete-list" type="text"><input name="" style="display: none;" type="text"> 
      </div> 
     </div> 
    </div> 
</body> 
</html> 

回答

1

好吧,如果你絕對要拆你的Javascript和HTML這樣的FilteringSelect來定義,我覺得你可以做喜歡的事,醜陋:

var targetInput = dojo.byId("test"); 
var spanWrapper = dojo.create("span"); 

dojo.place(wrapperSpan, targetInput, "replace"); 
dojo.place(targetInput, wrapperSpan); 

dojo.require("dijit.form.FilteringSelect"); 

var filteringSelect = new dijit.form.FilteringSelect({ 
    id: "test" 
}, "test"); 
+0

我被嚇壞了我剛纔張貼,但現在我只是想不到另一種方式。過去有一個wrap()方法,但顯然它不在那裏了。 – Frode 2010-11-12 21:35:25

+1

它仍然存在,只是很難找到 - http://dojotoolkit.org/api/dojo/NodeList.html但是,這將嵌套在標籤中的小部件。對於之前和之後的標籤,這不就是兩次調用dojo.create()嗎? – peller 2010-11-13 02:58:20

相關問題