Changeset 10580 for dijit/trunk/tests/tree/test_Tree_DnD.html
- Timestamp:
- 09/20/07 22:56:56 (16 months ago)
- Files:
-
- 1 modified
-
dijit/trunk/tests/tree/test_Tree_DnD.html (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dijit/trunk/tests/tree/test_Tree_DnD.html
r10488 r10580 11 11 @import "../css/dijitTests.css"; 12 12 @import "../dndDefault.css"; 13 14 @import "../../../dojo/resources/dojo.css"; 15 @import "../../../dojo/resources/dnd.css"; 16 @import "../../../dojo/tests/dnd/dndDefault.css"; 17 18 19 20 13 @import "../../../dojo/resources/dojo.css"; 14 @import "../../../dojo/resources/dnd.css"; 15 @import "../../../dojo/tests/dnd/dndDefault.css"; 21 16 </style> 22 17 … … 40 35 41 36 globalId=1000; 37 lastSelected=null; 42 38 43 39 dojo.addOnLoad(function(){ … … 64 60 parent: lastSelected, 65 61 attribute: "children" 66 } 62 }; 67 63 68 64 //store.newItem({name: dojo.byId('newCat').value, id:globalId++, numberOfItems:dojo.byId('numItems').value}, pInfo); … … 118 114 function tree2CheckItemAcceptance(node,source) { 119 115 var item = this.tree._domElement2TreeNode(node).item; 120 if ( this.tree.store.hasAttribute(item,"numberOfItems")){116 if (item && this.tree.store.hasAttribute(item,"numberOfItems")){ 121 117 var numItems=this.tree.store.getValues(item, "numberOfItems"); 122 118 return true; … … 145 141 146 142 function getIcon(item) { 147 if ( catStore.hasAttribute(item, "numberOfItems")) {143 if (!item || catStore.hasAttribute(item, "numberOfItems")) { 148 144 console.log("returning folder class"); 149 145 return "myFolder"; … … 152 148 return "myItem" 153 149 } 154 155 150 </script> 156 151 … … 178 173 <div dojoType="dojo.data.ItemFileWriteStore" jsId="catStore" 179 174 url="categories.json"></div> 180 181 182 183 175 184 176 <table width="100%" style="margin:5px solid gray" > … … 218 210 <h2>Collection Count Summary</h2> 219 211 <p>You can't drop items onto this tree.</p> 220 <div class="container" dojoType="dijit.Tree" id="myTree" store="catStore" labelAttr="name" getLabel="tree1CustomLabel" childrenAttr="children" dndController="dijit._tree.dndSource" checkAcceptance="dndAccept" getIconClass="getIcon"></div> 212 <div class="container" dojoType="dijit.Tree" id="myTree" store="catStore" label="Collections" 213 labelAttr="name" getLabel="tree1CustomLabel" childrenAttr="children" dndController="dijit._tree.dndSource" 214 checkAcceptance="dndAccept" getIconClass="getIcon"></div> 221 215 </td> 222 216 <td> 223 217 <h2>Collection</h2> 224 218 <p>Drop items onto this tree, but only on categories, should fail to let you drop on other items.</p> 225 <div class="container" dojoType="dijit.Tree" id="myTree2" store="catStore" labelAttr="name" childrenAttr="children, items" dndController="dijit._tree.dndSource" onDndDrop="tree2CustomDrop" checkAcceptance="dndAccept" checkItemAcceptance="tree2CheckItemAcceptance" getIconClass="getIcon"></div>219 <div class="container" dojoType="dijit.Tree" id="myTree2" label="Collections" store="catStore" labelAttr="name" childrenAttr="children, items" dndController="dijit._tree.dndSource" onDndDrop="tree2CustomDrop" checkAcceptance="dndAccept" checkItemAcceptance="tree2CheckItemAcceptance" getIconClass="getIcon"></div> 226 220 </td> 227 221 </tr> 228 222 </table> 229 223 230 231 224 </body> 232 225 </html>