1. #1
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    2
    Vote Rating
    1
    franck.pedrini is on a distinguished road

      0  

    Default Problem with setting api parameter under Config in Ajax Proxy

    Problem with setting api parameter under Config in Ajax Proxy


    Hello everyone,
    I just got started with Sencha Architect 2 and for my first project I followed along the working example found at:
    http://www.sencha.com/forum/showthre...-Architect-how
    (The fourth post by d.velev has said project attached).

    Now, I looked at the scripts to familiarise myself with the framework, and decided to create my own CRUD application via Architect, when I run up against the following problem;
    when I create a JsonStore from the Inspector, and select the Ajax Proxy, I wish to enter the four .php files that map to the four CRUD operations, like so:
    Code:
        read: "data/readUser.php",
        update: "data/updateUser.php",
        create:  "data/createUser.php",
        destroy: "data/destroyUser.php"

    so that part of the script would look like this:
    Code:
    ...
    proxy: {
            type: 'ajax',
            api: {
                read: 'data/readUser.php',
                update: 'data/updateUser.php',
                create: 'data/createUser.php',
                destroy: 'data/deleteUser.php'
            },
            reader: {
                        type: 'json',
                        root: 'data'
            }
    ...
    But when I open up Architect and navigate under Config, api, in the AjaxProxy of my JsonStore, all I can enter is a string of text which then automatically generates the following code:
    Code:
    ...
    proxy: {
                    type: 'ajax',
                    api: 'read: "data/readUser.php",\n    update: "data/updateUser.php",\n    create: "data/createUser.php",\n    destroy: "data/destroyUser.php"',
                    reader: {
                        type: 'json',
                        root: 'data'
                    }
                }
    ...

    which obviously doesn't work.
    I wonder what has to be entered in the 'api' field in order for Architect to generate the code I'm after.

    Thanks in advance for your help,

    Frank

  2. #2
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    8,185
    Vote Rating
    63
    aconran is just really nice aconran is just really nice aconran is just really nice aconran is just really nice aconran is just really nice

      0  

    Default


    You need to wrap what you entered in curly braces.

    Code:
    {
    // what you have currently
    }
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  3. #3
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    8,185
    Vote Rating
    63
    aconran is just really nice aconran is just really nice aconran is just really nice aconran is just really nice aconran is just really nice

      0  

    Default


    You pasted in
    Code:
        read: "data/readUser.php",
        update: "data/updateUser.php",
        create:  "data/createUser.php",
        destroy: "data/destroyUser.php"
    For the api config, you should have pasted in
    Code:
    {
        read: "data/readUser.php",
        update: "data/updateUser.php",
        create:  "data/createUser.php",
        destroy: "data/destroyUser.php"
    }
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  4. #4
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    2
    Vote Rating
    1
    franck.pedrini is on a distinguished road

      1  

    Default


    Sorted, thanks.
    Should I feel ashamed it was that simple? eheh

Tags for this Thread