我正在尝试来自此链接的示例http://livedocs.dojotoolkit.org/dojox/mobile/RoundRectDataList我放在这里:
require([
"dojo/ready",
"dojo/data/ItemReadStore",
"dojox/mobile/RoundRectDataList",
"dojox/mobile",
"dojox/mobile/parser"
], function(ready, ItemFileReadStore, RoundRectDataList){
ready(function(){
var storeData = {
"items": [
{ "label": "Wi-Fi", "icon": "images/i-icon-3.png", "rightText": "Off", "moveTo": "bar" },
{ "label": "VPN", "icon": "images/i-icon-4.png", "rightText": "VPN", "moveTo": "bar" }
]
};
var sampleStore = new ItemFileReadStore({data:storeData});
var dataList = new RoundRectDataList({store:sampleStore}, "dataList");
dataList.startup();
});
});
和html部分:
<ul id="dataList"></ul>
问题是我不能把它放在一个按钮上并重复相同的代码。因为得到这个错误:
Uncaught Error: Tried to register widget with id==dataList but that id is already registered
如果我销毁或清空它不再出现的节点......我该怎么办?<ul>
在 DOM 上销毁并创建相同的?