Skip to content

Chris' Laboratory

chrislee.kr – Personal blog as bookshelves

Menu
  • Home
  • Github
  • Contact Me
Menu

Sencha Touch Ext.Router.draw refresh issue

Posted on 09/11/201111/09/2016 by Chris Lee
Read Time:1 Minute, 24 Second

Sencha Touch 1.1.1

In my ‘route.js’ for Ext.Router.draw, I have custom route “map.connect” like:

Ext.Router.draw(function(map) {

map.connect('s/:specialName', { controller: 'Special', action: 'index' });

map.connect(':controller/:action');
});

 

The URL I used is like this “http://localhost/m/#s/am-i-right-3023”, which contains dash(-) in the URL.

If I refresh the browser with the URL, application is not reloading the page properly.

Apparently, Sencha Touch router does not accept dash(-) for the history URL.

 

So, I had a look Sencha Touch source code and found the line to define Regex for URL:

[line: 10729]

Ext.util.Route = Ext.extend(Object, {

constructor: function(config) {
Ext.apply(this, config, {
conditions: {}
});

this.paramMatchingRegex = new RegExp(/:([0-9A-Za-z\_]*)/g);

this.paramsInMatchString = this.url.match(this.paramMatchingRegex) || [];

this.matcherRegex = this.createMatcherRegex(this.url);
},

 

[line: 10786]

createMatcherRegex: function(url) {

var paramsInMatchString = this.paramsInMatchString,
length = paramsInMatchString.length,
i, cond, matcher;

for (i = 0; i < length; i++) {
cond = this.conditions[paramsInMatchString[i]];
matcher = Ext.util.Format.format("({0})", cond || "[%a-zA-Z0-9\-\\_\\s,]+");

url = url.replace(new RegExp(paramsInMatchString[i]), matcher);
}

return new RegExp("^" + url + "$");
}

 

It looks like paramMatchingRegex is forced to be set or I could not find the way to pass new Regex?

In anyway, to solve quickly, I modified below code[line:10794]:

matcher = Ext.util.Format.format("({0})", cond || "[%a-zA-Z0-9\\_\\s,]+");

to

matcher = Ext.util.Format.format("({0})", cond || "[%a-zA-Z0-9\-\\_\\s,]+");

 

It now, accepts dash(-). However, this is not good solution.

Better solution is passing configuration to Ext.util.Route from ‘route.js’.

I should keep looking for solution.

Share

Facebook
Twitter
LinkedIn
Email

Related

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Categories

  • Databases (11)
    • MongoDB (4)
    • MS-SQL (1)
    • MySQL (6)
  • E-Commerce (8)
    • Magento (8)
  • Finance (2)
  • Frameworks (84)
    • Adobe Flex (1)
    • Angular (ngx) (3)
    • Codeigniter (6)
    • CSS (5)
    • Django (2)
    • Javascript (13)
    • Node.js (6)
    • PHP (17)
    • React Native (4)
    • React.js (1)
    • Sencha Touch (4)
    • Terraform (1)
    • Vue.js (1)
    • WordPress (4)
    • Yii2 (3)
  • General Documents (15)
  • Marketing (3)
  • Mobile Development (33)
    • Android (20)
    • iPhone (13)
  • Platforms (21)
    • Arduino (2)
    • Docker (5)
    • Google App Engine (5)
    • Raspberry Pi (5)
    • Samsung Smart TV (4)
  • Security (17)
  • Server (30)
    • Linux (12)
  • Tools (14)
    • SVN (7)
  • Uncategorized (2)

Search

Recent Posts

  • Taint all resources in the one module
  • Alpine – Plugin caching_sha2_password could not be loaded
  • npm link with peerDependencies
  • How to setup Gitlab runner with KVM enabled
  • Failed to transform bcprov-jdk15on-1.68.jar

Recent Comments

  • Obayed on Binance Auto Trading Bot – Buy low/Sell high with stop loss limit/Trade multiple coins
  • Ari on How to install memcache.so/memcached.so for MAMP Pro (Mac)
  • Mida ali on Binance Auto Trading Bot – Buy low/Sell high with stop loss limit/Trade multiple coins
  • Chris Lee on How to install memcache.so/memcached.so for MAMP Pro (Mac)
  • Chris Lee on Setting Up A VPN Server On OSX 10.6

Tags

1 ajax amazon android android-addpart browser chrislee-kr codeigniter codeigniter-tcpdf com-apple-net-racoon CSS CSS history hack delpaigmail-com entity-addpart-double exception-printing-is-disabled-by-default-for-security-reasons ext-plugins-listpagingplugin ext-plugins-listpagingplugin-example f iphone javascript jquery-defaultchecked jquery-samsung-smart-tv listpagingplugin mac magento-exception-printing-is-disabled-by-default-for-security-reasons magento-sample-data-exception-printing-is-disabled-by-default-for-security-reasons nu-vot null-core-errors-confignotfound-config-mk9engine-ini php samsung-smart-tv-jquery samsung-smart-tv-sdk-ajax samsung-smart-tv-sdk-jquery samsung-tv-sdk samsung-tv-sdk-jquery samsung tv sencha-smart-tv sencha-touch-list-paging smart-tv-jquery sqlite subversion svn tcedook tcpdf-codeigniter uilinebreakmodecharacterwrap-is-deprecated unknown-column-link-area

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
© 2023 Chris' Laboratory | Powered by Minimalist Blog WordPress Theme