View Full Version : [CLOSED] EXT.router fails to pass file name to controller

7 Nov 2011, 8:16 AM
I was trying to create a custom route like
map.connect("pages/:url", {controller: 'main', action: 'show'});
to connects urls like "pages/mypage.html" to the main controller's show action, passing
"mypage.jpg" as the "url" property of the options object each controller action receives.
now it happens that the dot "." of the file extension breaks the router.
is it a bug?
should i implement it with something like Ext.override(Ext.util.Route, {createMatcherRegex: function (url) {... ?
Thank You for reading,

7 Nov 2011, 11:34 AM
Yes, this sounds like a bug to me as in the hash, "values" are separated by the forward-slash "/"

7 Nov 2011, 11:35 AM
That being said, the team is working very hard on Sencha Touch 2 so I'm not sure when Sencha Touch 1 will get some more loving so I would go ahead and create an override.

7 Nov 2011, 2:01 PM
Oh yeah, every body is on sencha 2 now,
just wondering when routers and dispatcer will be available for v2....
in the mean time, yes i'll go with the override,

9 Jan 2012, 5:28 PM
You should be able to do this by passing in a 'conditions' option:

new Ext.util.Route({
url: ':controller/:action/:page',
conditions: {
':page': "[a-zA-Z\.]+"

Matches urls like 'pages/show/mypage.html' (result looks like {controller: 'pages', action: 'show', page: 'mypage.html'})