1. #1
    Sencha User CSchmitz81's Avatar
    Join Date
    Nov 2012
    Location
    Saint Louis
    Posts
    33
    Answers
    3
    Vote Rating
    0
    CSchmitz81 is on a distinguished road

      0  

    Default Answered: Store class does not see URL config

    Answered: Store class does not see URL config


    Hi,

    I'm creating a website and I want to be able to read and write to and from a mysql database. I've built up my site and tested the store/model/gridpanel with inline data in the store to confirm it works.

    I then built a php file to access my database and return the matching data in json format. I've tested the php page out (by directly accessing it in the browser) and it does return the data correctly.

    The problem I'm running into is my store/proxy setup. When I fire up my site I and try to access the store, I get:

    Code:
    Uncaught Ext.data.proxy.Server.buildUrl(): You are using a ServerProxy but have not supplied it with a url.
    My store contains a url. The store looks like this:

    Code:
    Ext.define('CaRWedding.store.EventList',{
        extend   : 'Ext.data.Store',
        requires : ['Ext.data.reader.Json','Ext.data.writer.Json'],
    
    
        config:{
            model: 'CaRWedding.model.EventList',
    
    
            proxy:{
                type   : 'ajax',
                url    : 'resources/php/weddingdb.php',
                reader : 'json'
            }
    
    
        }
    });
    The url is definitely pointing to the right file (appending it to the end of the site's url returns the desired list(I'll be enabling the .htaccess file later so you can nav to the file, btw)), but I still get that error.

    Any tips??

    Thanks

  2. Hi CSchmitz89,

    Try the following code-
    Code:
    Ext.define('CaRWedding.store.EventList',{
        extend   : 'Ext.data.Store',
        requires : ['Ext.data.reader.Json','Ext.data.writer.Json'],     
       model: 'CaRWedding.model.EventList',
        proxy:{
           type   : 'ajax',
           url    : 'resources/php/weddingdb.php',
           reader : 'json' 
       }
    });

  3. #2
    Sencha Premium Member
    Join Date
    Feb 2009
    Location
    Glasgow, Scotland
    Posts
    328
    Answers
    10
    Vote Rating
    12
    Stuart-SwarmOnline will become famous soon enough Stuart-SwarmOnline will become famous soon enough

      0  

    Default


    If you remove the configuration from the "config" object it should work.

    I threw it into a sample project of mine and doing that made it work - although I was seeing different error messages to you.

    Hope this helps!

    Stuart

  4. #3
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,333
    Answers
    124
    Vote Rating
    85
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      0  

    Default


    Hi CSchmitz89,

    Try the following code-
    Code:
    Ext.define('CaRWedding.store.EventList',{
        extend   : 'Ext.data.Store',
        requires : ['Ext.data.reader.Json','Ext.data.writer.Json'],     
       model: 'CaRWedding.model.EventList',
        proxy:{
           type   : 'ajax',
           url    : 'resources/php/weddingdb.php',
           reader : 'json' 
       }
    });
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  5. #4
    Sencha User CSchmitz81's Avatar
    Join Date
    Nov 2012
    Location
    Saint Louis
    Posts
    33
    Answers
    3
    Vote Rating
    0
    CSchmitz81 is on a distinguished road

      0  

    Default


    Thanks Stoot98 and sword-it for your replies. That took care of the issue. I'm now getting a response back from my php and I can run with it from there.


    It does raise another question for me though, how do you determine when there should be and should not be a config object in your class definition?


    I had assumed up until now that any any item in the documentation listed under the 'Configs' section of the documentation needs to be enclosed within a config object in your class definition.


    How can you tell when something should be within a config object and when it shouldn't?

  6. #5
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,333
    Answers
    124
    Vote Rating
    85
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      0  

    Default


    I had assumed up until now that any any item in the documentation listed under the 'Configs' section of the documentation needs to be enclosed within a config object in your class definition.
    CSchmitz89,

    All config options of the relative class should be put direct (not under in config). As you seen in Store class there is no config option.
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

Thread Participants: 2

Tags for this Thread