8 Replies Latest reply on Sep 23, 2013 10:37 AM by elainecc

    How to change Id of a dynamically created child element?

    neverlan

      Hi,

       

      I would like to change the id of the dynamically created elements in order to work easily with their later. Currently, edge automatically generate an random id like "eid_1376057792551" for each element.

       

      There is my code :

       

               sym.setVariable("labels", {

                         content2: "Visiteur",

                         content3: "Exposant",

                         content4: "Organisateur",

                         content5: "Contact",

                         content6: "Connexion"

               });

       

       

       

               // Clear initial state

                                    sym.getSymbol("tab").deleteSymbol();

       

       

                                    // Find all large symbols in the library

                                    var prefix = "content"; // content1, content2 ... content99

                                    var allTabs = [];

                                    var symbolDefns = sym.getComposition().symbolDefns;

                                    for (var key in symbolDefns) {

                                      if (symbolDefns.hasOwnProperty(key) && key.search(new RegExp(prefix+"[0-9]{1,2}"))!=-1 ) {

                                               var tab = sym.createChildSymbol( "tab", "navigation" );

                                               tab.setVariable("contentId", key);

                                               allTabs.push(tab);

                                               tab.$("btnLabel").html( sym.getVariable("labels")[key] || "" );

                                               $tabEl = tab.getSymbolElement();

                                               $tabEl.data("sym", tab);

                                               $tabEl.css({float: "left", margin: "0 -1px 15px 0"});

                                               $tabEl.click(function(evt){

                                                        var tabSym = $(evt.currentTarget).data("sym");

                                                        $.each(allTabs, function(index,item) {

                                                                  if (item != tabSym) { item.stop("normal"); item.setVariable("active", false); }

                                                        });

                                                        var $content = sym.$("content").empty();

                                                        sym.createChildSymbol(tabSym.getVariable("contentId"), "content");

                                               });

                                      }

                                    }

       

       

            });

       

       

      Thank you .