0
我有一個基於dojo/dnd/Source
的小部件,我需要以編程方式將其節點之一的位置設置在特定位置,例如我需要在「救生衣」之後移動TIE figher
,我還需要保持拖動&排序功能,如下面的例子。dojo/dnd/Source如何以編程方式設置節點的順序?
我無法找到任何資料參考: https://dojotoolkit.org/reference-guide/1.10/dojo/dnd.html
http://dojotoolkit.org/api/?qs=1.10/dojo/dnd/Source
應改爲改變DOM的節點位置,或直接使用insertNodes()
和getAllNodes()
?
請問您能指出最佳方法嗎?
活生生的例子: https://jsfiddle.net/e8sk376h/
require([ "dojo/dnd/Source", "dojo/domReady!" ], function(Source){
var wishlist = new Source("wishlistNode");
wishlist.insertNodes(false, [
"Wrist watch",
"Life jacket",
"Toy bulldozer",
"Vintage microphone",
"TIE fighter"
]);
});
偉大的答案像往常一樣:)感謝您的時間在這個問題上! – GibboK
不客氣,我的榮幸:) – ben