Results 1 to 4 of 4

Thread: need some information about store proxy api

  1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    163

    Default Answered: need some information about store proxy api

    Hi

    This is my store code and my problem is once the update is done server returns
    Code:
    {"success":true}
    but the grid still showing little red flag in cell. any idea why its not removing after a successful update?


    Code:
    Ext.create('Ext.data.Store', {
        autoLoad     : true,
        autoSync    : true,
        fields   : [
            {name: 'ID',             type: 'string'},
            {name: 'item_code',     type: 'string'}
        ],
        storeId      : 'stock_store',
        pageSize     : 20,
        proxy    : {
            type            : 'ajax',
            actionMethods   : 'POST',
            api: {
                read    : BASE_URL+'raw_material_controller/load',
                create    : BASE_URL+'raw_material_controller/create',
                update    : BASE_URL+'raw_material_controller/update',
                destroy    : BASE_URL+'raw_material_controller/delete'
            },                
            reader: {
                type            : 'json',
                root            : 'data',
                totalProperty    : 'total',
                idProperty        : 'ID',
                successProperty    : 'success',
                messageProperty    : 'message'            
            },
            writer            : {
                    type        : 'json',
                    root        : 'data'
            },
            listeners: {
                exception: function(proxy, response, operation)
                {
                    Ext.MessageBox.show({
                        title    : 'REMOTE EXCEPTION',
                        msg        : operation.getError(),
                        icon    : Ext.MessageBox.ERROR,
                        buttons    : Ext.Msg.OK
                    });
                }
            }                
        }
    });
    Regards

  2. Yes you do. This allows for serverside altering to enforce some rules, incorporate derived data and things like that.

    Code:
    {
      "success": true,
      "data": { urRecord }
    }

  3. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379
    Answers
    3997

    Default

    When you do an update or create, you need to return the data of the record.. say you create a record so the id field doesn't reflect a real id... The call sends the create call and the server generates a real id and returns all the data... the Store will now update the record with that real id.
    Mitchell Simoens @LikelyMitch

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

    Posts are my own, not any current, past or future employer's.

  4. #3
    Sencha User
    Join Date
    Jul 2011
    Posts
    163

    Default

    sorry for this, i didnt understand though.

    so once update done i have to return the updated record with the success message?

  5. #4
    Sencha User
    Join Date
    Dec 2009
    Location
    Enschede, The Netherlands
    Posts
    327
    Answers
    16

    Default

    Yes you do. This allows for serverside altering to enforce some rules, incorporate derived data and things like that.

    Code:
    {
      "success": true,
      "data": { urRecord }
    }

Posting Permissions

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