PDA

View Full Version : Domhelper to insert new Desktop Folder/icon



Aero
9 Jun 2010, 12:06 PM
Hi,

How do i (if even possible) use domhelper append or insertafter the following syntax



<dt id="Folder-shortcut">
<a href="#"><img src="images/s.gif" />
<div>New Folder</div></a>
</dt>



This is under div id='x-desktop' and <dl id="x-shortcuts"> in the desktop.html doc

i started doing it by adding a right-click listener



Ext.getDoc().on({'contextmenu': function(e)
{



var addMenu=CustomFunction.menu()

})



Where CustomFunction.js implements a contextmenu with the option to add "new folder". I added a handler to it and made a CreateFolder function.

But how do i create the Div in this function with domhelper...something like:



Ext.DomHelper.insertAfter('x-shortcuts',{tag:'dt',id:'Folder-shortcut',children: [{tag: 'a', href:'#'},{tag:'img',src:'image/s.gif'}]);



It display something,no image and no text (but i didn't added that with a children)...anyone sees something wrong by doing this ?

Thanks!

Aero
9 Jun 2010, 12:56 PM
Saved by Firebug,so this works:



Ext.DomHelper.insertAfter('Some-shortcut',{tag:'dt',id:'Folder-shortcut',children: [{tag: 'a', href:'#',children: [{tag:'img',src:'image/s.gif'}]}]});


Now on to some drag handle to these shortcuts..:-?