Opened 10 years ago
Closed 10 years ago
#12551 closed defect (fixed)
dojox.mobile.Heading moveTo does not work with hash
Reported by: | bluk | Owned by: | ykami |
---|---|---|---|
Priority: | high | Milestone: | 1.7 |
Component: | DojoX Mobile | Version: | 1.6.0 |
Keywords: | 1.7-mobile | Cc: | |
Blocked By: | Blocking: |
Description
In my dojox.mobile application, I have a header like:
<h2 dojoType="dojox.mobile.Heading" back="Home" moveTo="#home">Header</h2>
I require dojo.hash in my code. The latest trunk version of Dojo has an undefined error in dojox.mobile.Heading#goTo function when I click on the back button.
var view = this._view; var parent = dijit.byId(moveTo).getParent(); while(view){ var myParent = view.getParent(); if (parent == myParent){ break; } view = myParent; } if(view){ view.performTransition(moveTo, -1, this.transition); } }
The problem is in the dijit.byId(moveTo) call. The moveTo could contain a hash like "#home" which dijit.byId() will not work with.
I temporarily changed the code to:
var viewMoveTo = moveTo; if(moveTo !== undefined && typeof(moveTo) == "string" && moveTo.charAt(0) == '#'){ moveTo.match(/^#?([^&]+)/); viewMoveTo = RegExp.$1; } var view = this._view; var parent = dijit.byId(viewMoveTo).getParent();
I'm not sure if that's the right fix but it allowed me to make progress.
Change History (2)
comment:1 Changed 10 years ago by
Keywords: | 1.7-mobile added |
---|
comment:2 Changed 10 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note: See
TracTickets for help on using
tickets.
You are correct, and your fix looks ok. I will slightly modify you fix simply because I don't want to duplicate the pattern matching code.