dojo.dnd.Avatar.construct
dojo.require("dojo.dnd.Avatar");
defined in dojo/dnd/Avatar.js
a constructor function; it is separate so it can be (dynamically) overwritten in case of need
Usage
function () (view source)
var a = dojo.doc.createElement("table"); a.className = "dojoDndAvatar"; a.style.position = "absolute"; a.style.zIndex = 1999; a.style.margin = "0px"; // to avoid dojo.marginBox() problems with table's margins var b = dojo.doc.createElement("tbody"); var tr = dojo.doc.createElement("tr"); tr.className = "dojoDndAvatarHeader"; var td = dojo.doc.createElement("td"); td.innerHTML = this._generateText(); tr.appendChild(td); dojo.style(tr, "opacity", 0.9); b.appendChild(tr); var k = Math.min(5, this.manager.nodes.length); var source = this.manager.source; for(var i = 0; i < k; ++i){ tr = dojo.doc.createElement("tr"); tr.className = "dojoDndAvatarItem"; td = dojo.doc.createElement("td"); if(source.creator){ // create an avatar representation of the node node = source._normalizedCreator(source.getItem(this.manager.nodes[i].id).data, "avatar").node; }else{ // or just clone the node and hope it works node = this.manager.nodes[i].cloneNode(true); if(node.tagName.toLowerCase() == "tr"){ // insert extra table nodes var table = dojo.doc.createElement("table"), tbody = dojo.doc.createElement("tbody"); tbody.appendChild(node); table.appendChild(tbody); node = table; } } node.id = ""; td.appendChild(node); tr.appendChild(td); dojo.style(tr, "opacity", (9 - i) / 10); b.appendChild(tr); } a.appendChild(b); this.node = a;