javascript - dojox.mobile.ListItem OnClick not working -
i trying call function when listitem
clicked in dojo mobile application.
this function programatically creates listitems
showresults : function(results) { results.foreach(function(result) { var li = new dojox.mobile.listitem({ class : "linklist", href : "#", label : result.address, moveto : "#", clickable : true, onclick : function() { console.log("click"); } }, domconstruct.create("li", null, this.searchlist)); // dojo.connect(li, "click", lang.hitch(this, this.addresult, result)) }, this); }
i have tried providing function onclick
property in constructor, using dojo.connect
after creation. neither way works. i've tried different variations of click
, onclick
, , onclick
.
any other posts have seen regarding issue have suggested using dojo.connect
method commented above, still not working me.
any suggestions?
this because widget's startup() method never called. must either call li.startup() explicitly, or, instead of creating , passing reference node listitem constructor, use this.searchlist.addchild(li) (this cause startup() called properly).
Comments
Post a Comment