1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    44
    Vote Rating
    0
    Answers
    4
    nothing is an unknown quantity at this point

      0  

    Default Answered: Create new DIV and add to extisting DIV

    Answered: Create new DIV and add to extisting DIV


    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:
    Code:
    <div id="window.all.desktop.taskBar_tbar" class="TTaskBar_Entrys" style=""></div>

    1. Get the exisiting Div
    Code:
    oTaskbar = Ext.fly('window.all.desktop.taskBar_tbar');
    2. Create the new Div element
    Code:
    // 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?

  2. Your option #1 worked fine for me when I tried it. Perhaps there is other javascript code that's interfering somehow?

  3. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,154
    Vote Rating
    475
    Answers
    686
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    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.

  4. #3
    Ext JS Premium Member burnnat's Avatar
    Join Date
    Jun 2011
    Posts
    418
    Vote Rating
    61
    Answers
    42
    burnnat is a jewel in the rough burnnat is a jewel in the rough burnnat is a jewel in the rough burnnat is a jewel in the rough

      0  

    Default


    Your option #1 worked fine for me when I tried it. Perhaps there is other javascript code that's interfering somehow?

  5. #4
    Sencha User
    Join Date
    Apr 2012
    Posts
    44
    Vote Rating
    0
    Answers
    4
    nothing is an unknown quantity at this point

      0  

    Default


    Indeed it worked. There is another framework deleting stuff in the div later on. I cant believe it. Thanks.

Thread Participants: 2