3
insertNodesを使用する場合、ノードに対して一意のIDが作成されます。dojoでのinsertnodes使用時にidを設定します。
insertNodes(addSelected, data, before, anchor)
新しいノードのIDとして特定の名前/テキストを割り当てるにはどうすればよいですか?
insertNodesを使用する場合、ノードに対して一意のIDが作成されます。dojoでのinsertnodes使用時にidを設定します。
insertNodes(addSelected, data, before, anchor)
新しいノードのIDとして特定の名前/テキストを割り当てるにはどうすればよいですか?
カスタムの「作成者」関数を作成し、アイテムにIDを設定します。 例:あなたのJavaScriptでは、あなたのHTML内
<ol id="listNode">
</ol>
:の
require(["dojo/dnd/Source"]);
function myCreator(item, hint) {
var myLi = dojo.create('li', { id : item.id, innerHTML: item.text });
if (hint == 'avatar') {
// create your avatar if you want
myLi.innerHTML = "Moving " + item.text + "...";
}
return {node: myLi, data: item, type: "foo"};
}
dojo.ready(function() {
var list = new dojo.dnd.Source("listNode", {creator: myCreator});
list.insertNodes(false, [
{ id : "id1", text : "foo"},
{ id : "id2", text : "bar"},
{ id : "id3", text : "baz"}
]);
});
可能重複して[設定属性道場でinsertnodesを使用している間](http://stackoverflow.com/questions/ 8514772/set-attribute-using-using-dojo-in-dojo) – hugomg