I'm developing an extjs application with Sencha Cmd v6.5.3.6 and modern toolkit. My app always handles the url with parameters, example:
http:localhost:1841/#users?language=es&tenant=Number
I use the language parameter to identify the location and the tenant for the current user login in the app.
How can I define a route that handles urls and parameters inside it?
For the last example, how can I implement a route for the next url?:
http:localhost:1841/#users?language=es&tenant=1, define a route that reads the token "users" but ignore the parameters "language" and "tenant".
routes : {
'users?...' : 'onUsers'
},
onUsers: function(){
....
}
You have few options really. The recommended one as per Sencha is to set your route as:
routes : {
'users/:language/:tenant' : 'onUsers'
},
onUsers: function(language, tenant){
....
}
Another one would be to go your current way but to do this:
routes : {
'users/:params' : 'onUsers'
},
onUsers: function(params){
....
}
and then to deal with the "recovering" the parameters from that string you would have in params.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With