I have a function that adds buttons to a div "dettaglio_utenti" after calling the function with this command < / P>
tab + = "& lt; button data-dojo-type = 'dojox.mobile.button' id = 'apri_mappa' onClick = \" location.href = telephone: "+ telephone +" '\ "& Gt; Epi Mappa & lt; / button & gt; Var vText = document.getElementById ("detaglio_utente"); VText.innerHTML = Tab; Requirement (["dojo / parser"], function (parser) {parser.parse (vText);}); This only works for the first time that I display the page. The second time the button is not parsed and I see this error in the browser console: dojo / parser :: parse () error error: tried to register the widget with id == apri_mappa but this id first Only registered
When you display the page for the second time, the first page still Must be a part of the domain. (Maybe this is a vertical feature, a single page app?). So when the dojo parses another page, this error returns because the button is already made with that ID.
I do not believe that the second time you will meet your need to stop the parsing of the button. I think your options are:
- Delete the widget from the first page.
- If you do not need an ID on the button, then you can skip it and make an dojo an id that will not come in collision.
- If you need an ID, you can use or use the counter when you remove the button's ID.
id = 'apri_mappa_' + i where i'm counter After only knowing what you wrote above, I think the order of priority is 2,1,3.
Edit - How to Delete a Widget
is required (['Exit / Registry'], Function (Registry) {registry.byId} ('Apri_mappa'). Destruction ();});
No comments:
Post a Comment