Results 1 to 2 of 2

Thread: ExtJS 6.2 videModel store CORS not working

  1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    6

    Default ExtJS 6.2 videModel store CORS not working

    Hello,
    The following CORS works perfectly when defined from stores:

    Code:
    Ext.define('EDUX.store.Students', {
        extend: 'Ext.data.Store',
        alias: 'store.students',
        fields: ['fname', 'lname', 'age', 'enrol', 'class',  'gender', 'dom', 'year', 'course', 'pic'],
        proxy: {
            type: 'ajax',
            method: 'get',
            withCredentials: true,
            url: global.getBaseUrl() + 'api/api.php?student=view',
            reader: {type: 'json',    rootProperty: 'rows'
            }
        }
    });
    However, when I define the same store inside the viewModel stores, CORS fails. Following is the code:

    Code:
    Ext.define('EDUX.view.settings.SettingsModel', {
        extend: 'Ext.app.ViewModel',
        alias: 'viewmodel.settings',
        data: {
            name: 'EDUX',
            school: 'Programme'
        },
        stores: {
            students: {
                fields: ['fname', 'lname', 'age', 'enrol', 'class',  'gender', 'dom', 'year', 'course', 'pic'],
                withCredentials: true,
                proxy: {
                    url:global.getBaseUrl() + 'api/api.php?student=view',
                    type: 'ajax', 
                    reader: {
                        type: 'json', 
                        rootProperty: 'rows'
                    }},
                    autoLoad:true
            }
    })
    Is this a bug or am I doing it wrongly?

  2. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,256
    Answers
    759

    Default

    I attempted to fix up some of the formatting in your post, but it seems like the declarations aren't the same.

    For the viewmodel:
    1) You've omitted the method config
    2) withCredentials is outside of the proxy
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

Similar Threads

  1. Ext.Ajax.request CORS not working
    By marco.napetti in forum Ext 5: Q&A
    Replies: 5
    Last Post: 17 Oct 2014, 12:01 AM
  2. Replies: 8
    Last Post: 25 Feb 2014, 2:16 PM
  3. Extjs store.load with id causes CORS error
    By wayne-oo in forum Ext: Q&A
    Replies: 3
    Last Post: 27 Aug 2013, 11:50 PM
  4. Working CORS example
    By btek in forum Sencha Touch 2.x: Discussion
    Replies: 11
    Last Post: 2 Nov 2012, 7:13 AM

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
  •