1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    3
    Vote Rating
    0
    abysmatic is on a distinguished road

      0  

    Default Variables in config properties

    Variables in config properties


    Hi everyone,

    I apologize if I'm asking a trivial and silly question, but how can you add variables to the config properties in Sencha Architect?

    I need to dynamically get a parent's id when I'm setting up its children's proxy. As so:

    Code:
    {
    "create":"http://localhost:8080/ucf/rest/interestTerm/"+ interestTermID +"/rateHistory",
    "read":"http://localhost:8080/ucf/rest/interestTerm/"+ interestTermID +"/rateHistory",
    "update":"http://localhost:8080/ucf/rest/interestTerm/"+ interestTermID +"/rateHistory",
    "destroy":"http://localhost:8080/ucf/rest/interestTerm/"+ interestTermID +"/rateHistory"
    }
    But if I add this code to the config in Architect, it automatically converts it to string. It works fine without the variable, I'm putting it in the api property, which should expect an object.
    Last edited by abysmatic; 17 May 2012 at 7:29 AM. Reason: Added more to my post.

  2. #2
    Sencha User
    Join Date
    Sep 2011
    Posts
    3
    Vote Rating
    0
    abysmatic is on a distinguished road

      0  

    Default


    ...or if there's an alternative Sencha Architect way of using GET parameters within proxies when calling REST services, some light on the subject would be great as this is a total road block.

  3. #3
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,168
    Vote Rating
    119
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    The only way to use variables in these properties at this time is via an override.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  4. #4
    Sencha User
    Join Date
    Sep 2011
    Posts
    3
    Vote Rating
    0
    abysmatic is on a distinguished road

      0  

    Default


    Yes, or in my case I just ended up modifying the properties dynamically in my controllers whenever I need to.

  5. #5
    Sencha User thesilentman's Avatar
    Join Date
    Apr 2007
    Location
    Athens, Greece
    Posts
    232
    Vote Rating
    2
    thesilentman is on a distinguished road

      0  

    Default


    So today I needed to actually assign a variable to a property, and didn't like the way SA doesn;tallow us to...

    This might be a silly question, but here it goes...

    Why doesn't SA just let us decide if we want a string or something else? If we want a string we'll surround it by quotes ourselves; if we want a variable we'll have a variable; if we want the assignment to be re result of an anonymous function, we'll do that....

    I find this to be an unconvenient restriction. And having to do an override on afterRender is not a really elegant solution....

    Cheers,
    Frank

  6. #6
    Sencha - Architect Dev Team jjohnston's Avatar
    Join Date
    Sep 2010
    Posts
    512
    Vote Rating
    17
    jjohnston will become famous soon enough jjohnston will become famous soon enough

      0  

    Default


    Quote Originally Posted by thesilentman View Post
    I find this to be an unconvenient restriction.
    Believe me, we all agree with you and have had considerable discussion around it. Not to go into too much detail, but there are some significant issues to work out to do this properly, for instance how would the canvas be rendered if config properties become dynamic, etc. These are not insurmountable issues most likely but definitely not simple. I'm not sure where in our list of priorities this lies.
    Jason Johnston
    @lojjic
    Sencha Architect Development Team

  7. #7
    Sencha User thesilentman's Avatar
    Join Date
    Apr 2007
    Location
    Athens, Greece
    Posts
    232
    Vote Rating
    2
    thesilentman is on a distinguished road

      0  

    Default


    Yes, I get your point. For that to work, SA would have to evaluate possible variables or functions, kind of executing the application but with realtime designing... .
    Please forgive my ignorance , ok, I'll stick with overrides for now. Don't want to cause the sencha devs headaches .

  8. #8
    Sencha User
    Join Date
    Apr 2010
    Posts
    4
    Vote Rating
    0
    zouzhijun is on a distinguished road

      0  

    Default variables in config property is really useful for localization

    variables in config property is really useful for localization


    Architect is functional for big app development now, but I found that Ext's localization support is not so good, I think you should really think about add some string properties with 'limited function support' for architect. please read this link:http://stackoverflow.com/questions/7...ading-and-i18n,that's really a good method for localization. Think about a property value like 'some value'.translate(), just render it as a string like 'translate()' return nothing . so some pre-dedfined function could be supported, or just functions with pre-defined return value. That's will be very helpful!

  9. #9
    Sencha Premium Member
    Join Date
    May 2010
    Location
    Guatemala, Central America
    Posts
    1,264
    Vote Rating
    80
    ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough

      0  

    Default


    If you control your rest server code make them to play nicely with rest proxy allowing other path to get the same data.

    Without knowing anything about your application, if you are using JAX-RS just convert the parameter from PathParam to QueryParam and change the URL:

    PHP Code:
    @Path("/interestTerm/rateHistory")
    public 
    String rateHistory(@QueryParam("id"long id) {... 
    And set the id in extraParams of the proxy before load:

    PHP Code:
    store.getProxy().extraParams = { idinterestTermID };
    store.load(); 
    If you use your REST service from another application and you cant change the way I'm suggesting, just add a new method with the new path which calls exising metod.

    Regards.
    UI: Sencha Architect 3.x / ExtJS 4 & 5
    Server side: JEE / EJB 3.x / CDI / JPA 2.x/ JAX-RS / JasperReports
    Application Server: Glassfish / WildFly
    Databases: Oracle / DB2 / MySQL / Firebird

    If you like my answer please vote!

  10. #10
    Sencha Premium Member
    Join Date
    May 2010
    Location
    Guatemala, Central America
    Posts
    1,264
    Vote Rating
    80
    ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough

      0  

    Default


    Quote Originally Posted by thesilentman View Post
    So today I needed to actually assign a variable to a property, and didn't like the way SA doesn;tallow us to...
    Depending on the context you can set those values in controller events.

    For example, I have a window which must show/hide or change labels and so on components depending on user rights or current task. I use the beforeRender event to set them and in some cases the window's controller haves a method "show()" which instantiates the view and changes whatever is needed then show the view.

    Regards.
    UI: Sencha Architect 3.x / ExtJS 4 & 5
    Server side: JEE / EJB 3.x / CDI / JPA 2.x/ JAX-RS / JasperReports
    Application Server: Glassfish / WildFly
    Databases: Oracle / DB2 / MySQL / Firebird

    If you like my answer please vote!

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."