Results 1 to 4 of 4

Thread: How to use global variable for store URL

  1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    6
    Vote Rating
    0
      0  

    Default How to use global variable for store URL

    I want to use global variable for my store. I want to know where to declare global variable.
    My store is set to autoLoad true. I tried declaring variable in Ext.launch function , but the store is loaded even before the launch function

    my store
    Code:
    Ext.define("myapp.store.Bstore",{    extend:"Ext.data.Store",
        
        config:{
            
            model:"myapp.model.Bmodel",
             autoLoad:true,
            proxy:{
            type:'ajax',
            url: myapp.baseURL + '/bulletin/',
            reader:{
            type:'json',
            }
            }, }});

    My launch function
    Code:
       launch: function() {
    *****
    		 myapp.baseURL = 'http://10.5.82.27:9191/';
    
    
    		
     ****    
        
        },

  2. #2
    Sencha User jerome76's Avatar
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    1,149
    Answers
    132
    Vote Rating
    101
      0  

  3. #3
    Sencha User
    Join Date
    Jul 2012
    Posts
    6
    Vote Rating
    0
      0  

    Default

    The solution you gave worked. But when i build the app as package. I get error again.

    Error : Uncaught TypeError: Cannot read property 'base_url' of undefined

  4. #4
    Sencha User
    Join Date
    Nov 2012
    Location
    Saudi Arabia
    Posts
    3
    Vote Rating
    0
      0  

    Default

    Quote Originally Posted by syedimty View Post
    The solution you gave worked. But when i build the app as package. I get error again.

    Error : Uncaught TypeError: Cannot read property 'base_url' of undefined
    try to use myapp.app.baseURL it will work

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •