Languages

Menu
Sites
Language
Open popup not working for dynamically constructed popup

 

 

I'm working with Samsung Gear 2 -  trying to dynamically construct a popup in Javascript and open it using tau.openPopup(). However, I can't get the popup to open. Here is my code:

 nobutton = document.createElement("a");
nobutton.className = "ui-btn ui-btn-main ui-color-red ui-multiline ui-inline";
nobutton.href = "#1btnPopup"
nobutton.setAttribute("data-rel", "popup");
nobutton.addEventListener('click', function(){ 
var testpopup = document.createElement("div");
testpopup.id = "1btnPopup";
testpopup.className = "ui-popup";
tau.openPopup(document.getElementById("#1btnPopup"));
tau.openPopup(document.getElementById("1btnPopup")); 
tau.openPopup(testpopup); 
});

 

I have tried each of the last 3 statements individually and none of them works - the button just doesn't react. I have all the proper JavaScript and CSS files in place, such as tau.css. I've looked at this topic
http://developer.samsung.com/forum/board/thread/view.do?boardName=SDK&messageId=265647&startId=zzzzz~&searchType=ALL&searchText=open+popup
but it didn't help me. Any suggestions as to what could be messing this up appreciated.
Thanks

Responses

2 Replies
Marco Buettner
you create the reference object after calling???? you have to create the popup before.. When you call your target "#1btnPopup" its not available on DOM. Why you dont define the popup directly on html? it will only show when it calls else its hidden.
Marco Buettner
btw you have to use tau.openPopup(target) :) fyi