PDA

View Full Version : Create new DIV and add to extisting DIV



nothing
28 Jun 2012, 3:24 AM
I have tried all kinds of functions to create a new div and add it to my existing DOM div. Nothing works.

My existing Div looks like this:


<div id="window.all.desktop.taskBar_tbar" class="TTaskBar_Entrys" style=""></div>



1. Get the exisiting Div


oTaskbar = Ext.fly('window.all.desktop.taskBar_tbar');


2. Create the new Div element


// Tried #1: Did this
oTaskbar.createChild({tag: 'div', html: 'blabla'});

// Tried #2: I also tried this like
var div = new Ext.Element(document.createElement('div'));
oTaskbar.createChild(div);

// Tried #3: and even tried
oTaskbar.appendChild("<div class='taskBar_EntryAct'>abc</div>");


3. Do I have to update DOM to make the changes happen?

scottmartin
28 Jun 2012, 11:31 AM
This is more of a JS question .. something like:

document.createElement("div");

You can then use renderTo to assign you component to the dev.

Scott.

burnnat
28 Jun 2012, 12:02 PM
Your option #1 worked fine for me when I tried it. Perhaps there is other javascript code that's interfering somehow?

nothing
28 Jun 2012, 11:07 PM
Indeed it worked. There is another framework deleting stuff in the div later on. I cant believe it. Thanks.