Results 1 to 5 of 5

Thread: Ajax proxy fiddle doesn't load relative path simpsons.json file -- why not?

  1. #1
    Sencha Premium User
    Join Date
    Jul 2017
    Location
    Lawrence, KS
    Posts
    5
    Vote Rating
    0
      0  

    Default Answered: Ajax proxy fiddle doesn't load relative path simpsons.json file -- why not?

    Fiddle example: https://fiddle.sencha.com/#view/editor&fiddle/2700

    Creating the most simple of examples that I could conjure, I'm not seeing the reason why this fiddle won't load the relatively referenced Simpsons.json file.

    • Code taken directly from the first fiddle of this doc page:
    https://docs.sencha.com/extjs/6.5.1/...rid.Panel.html

    • And then referring to the fiddle doc:
    https://docs.sencha.com/extjs/6.5.1/...roxy.Ajax.html

    Code:
    Ext.create('Ext.data.Store', {
        storeId: 'simpsonsStore',
        fields: ['name', 'email', 'phone'],
        proxy: {
            type: 'ajax',
            url: 'Data/Simpsons.json',
            reader: 'json'
        }
        // • Moved following data into: Data/Simpsons.json
        // • converted data to valid json w/ double quotes
        // data: [{
        //     name: 'Lisa',
        //     email: 'lisa@simpsons.com',
        //     phone: '555-111-1224'
        // }, {
        //     name: 'Bart',
        //     email: 'bart@simpsons.com',
        //     phone: '555-222-1234'
        // }, {
        //     name: 'Homer',
        //     email: 'homer@simpsons.com',
        //     phone: '555-222-1244'
        // }, {
        //     name: 'Marge',
        //     email: 'marge@simpsons.com',
        //     phone: '555-222-1254'
        // }]
    });
    
    
    Ext.create('Ext.grid.Panel', {
        title: 'Simpsons',
        store: Ext.data.StoreManager.lookup('simpsonsStore'),
        columns: [{
            text: 'Name',
            dataIndex: 'name'
        }, {
            text: 'Email',
            dataIndex: 'email',
            flex: 1
        }, {
            text: 'Phone',
            dataIndex: 'phone'
        }],
        height: 200,
        width: 400,
        renderTo: Ext.getBody()
    });

  2. Two reasons:

    1) The path shouldn't have 'Data/' in it, that is just a tree node describing it's children just like Assets and Packages
    2) You aren't telling your store to load. You can add autoLoad: true to your store to make it load when it's instantiated

  3. #2
    Sencha - Community Support Team mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,023
    Answers
    3976
    Vote Rating
    1364
      0  

    Default

    Two reasons:

    1) The path shouldn't have 'Data/' in it, that is just a tree node describing it's children just like Assets and Packages
    2) You aren't telling your store to load. You can add autoLoad: true to your store to make it load when it's instantiated
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  4. #3
    Sencha Premium User
    Join Date
    Jul 2017
    Location
    Lawrence, KS
    Posts
    5
    Vote Rating
    0
      0  

    Default

    BAM! That was quick.

    I still don't understand how it knows to look in the Data directory for the json file. Is that something setup in the fiddle context?

  5. #4
    Sencha - Community Support Team mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,023
    Answers
    3976
    Vote Rating
    1364
      1  

    Default

    Yes, that is a fiddle thing. When fiddle 1 was around, it didn't make live network calls for anything so having them split made sense for the ajax requests and since there were over 50,000 fiddles and fiddle 2 can work in a fiddle 1 way (so it doesn't break old fiddles) it has to be kept separate. In a new fiddle, you can assume the Assets and Data are merged into one file system.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  6. #5
    Sencha Premium User
    Join Date
    Jul 2017
    Location
    Lawrence, KS
    Posts
    5
    Vote Rating
    0
      0  

    Default

    Thanks Mitchell!

Similar Threads

  1. Building with relative build path doesn't work (CD not set)
    By maikhorma in forum Sencha Architect 3.x: Bugs
    Replies: 0
    Last Post: 14 Feb 2014, 2:45 PM
  2. Store with Ajax Proxy to json file
    By ccrosetti in forum Ext: Q&A
    Replies: 2
    Last Post: 29 Jul 2013, 3:48 PM
  3. [CLOSED] 2.1 : error message with ajax proxy relative path
    By afro in forum Sencha Architect 2.x: Bugs
    Replies: 2
    Last Post: 21 Aug 2012, 10:22 PM
  4. Replies: 0
    Last Post: 18 Aug 2011, 3:44 PM
  5. Relative File Path
    By khskinsfan in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 13 Aug 2008, 4:25 PM

Tags for this Thread

Posting Permissions

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