1. #1
    Sencha User
    Join Date
    Aug 2012
    Posts
    2
    Answers
    1
    Vote Rating
    0
    alanuofm is on a distinguished road

      0  

    Default Answered: requestpayload in post is always query string

    Answered: requestpayload in post is always query string


    Hey folks,

    I'm having an issue with a proxy post request payload that is always posting as a query string instead of a json string.

    Here is what my model currently looks like with a specified proxy.

    Code:
    Ext.define('HL.store.FacetListTreeStore', {    extend: 'Ext.data.TreeStore',
        model: 'HL.model.FacetsTreeModel',
        autoLoad: true,
        proxy: {
            type: 'ajax',
            headers: {
                'Content-Type': 'application/json; charset=UTF-8',
                'Accept' : 'application/json, text/javascript, */*; q=0.01'
            },
            url: 'test.json',
            reader: {
                type: 'json',
                root: 'ResultSet'
            },
            writer: {
                type: 'json'
            },
            actionMethods: {
                create: 'POST',
                read: 'POST',
                update: 'POST',
                destroy: 'POST'
            },
            extraParams: {
                recordOffset : "0",
                rowsPerPage : "50"
            }
    
    
        }
    });
    The post request payload is always posting as

    recordOffset=0&rowsPerPage=50

    Any ideas on how to make it post as a json body such that it is {"recordOffset":0,"rowsPerPage":50}


    Thanks,

    Alan

  2. ok in case anyone is wondering here is the solution that I used

    Code:
    Ext.define('HL.store.FacetListTreeStore', {    extend: 'Ext.data.TreeStore',
        model: 'HL.model.FacetsTreeModel',
        autoLoad: true,
        proxy: {
            type: 'ajax',
            headers: {
                'Content-Type': 'application/json; charset=UTF-8',
                'Accept' : 'application/json, text/javascript'
            },
            url: 'test.json',
            reader: {
                type: 'json',
                root: 'ResultSet'
            },
            writer: {
                type: 'json'
            },
            actionMethods: {
                create: 'POST',
                read: 'POST',
                update: 'POST',
                destroy: 'POST'
            },
            extraParams: {
                recordOffset : "0",
                rowsPerPage : "50"
            },
            doRequest: function(operation, callback, scope){
                var writer  = this.getWriter();
                var request = this.buildRequest(operation, callback, scope);
    
    
                if (operation.allowWrite()) {
                    request = writer.write(request);
                }
    
    
                Ext.apply(request, {
                    headers       : this.headers,
                    timeout       : this.timeout,
                    scope         : this,
                    callback      : this.createRequestCallback(request, operation, callback, scope),
                    method        : this.getMethod(request),
                    jsonData        : this.extraParams,
                    disableCaching: false // explicitly set it to false, ServerProxy handles caching
                });
                Ext.Ajax.request(request);
                return request;
            }
        }
    });

  3. #2
    Sencha User
    Join Date
    Aug 2012
    Posts
    2
    Answers
    1
    Vote Rating
    0
    alanuofm is on a distinguished road

      0  

    Default


    ok in case anyone is wondering here is the solution that I used

    Code:
    Ext.define('HL.store.FacetListTreeStore', {    extend: 'Ext.data.TreeStore',
        model: 'HL.model.FacetsTreeModel',
        autoLoad: true,
        proxy: {
            type: 'ajax',
            headers: {
                'Content-Type': 'application/json; charset=UTF-8',
                'Accept' : 'application/json, text/javascript'
            },
            url: 'test.json',
            reader: {
                type: 'json',
                root: 'ResultSet'
            },
            writer: {
                type: 'json'
            },
            actionMethods: {
                create: 'POST',
                read: 'POST',
                update: 'POST',
                destroy: 'POST'
            },
            extraParams: {
                recordOffset : "0",
                rowsPerPage : "50"
            },
            doRequest: function(operation, callback, scope){
                var writer  = this.getWriter();
                var request = this.buildRequest(operation, callback, scope);
    
    
                if (operation.allowWrite()) {
                    request = writer.write(request);
                }
    
    
                Ext.apply(request, {
                    headers       : this.headers,
                    timeout       : this.timeout,
                    scope         : this,
                    callback      : this.createRequestCallback(request, operation, callback, scope),
                    method        : this.getMethod(request),
                    jsonData        : this.extraParams,
                    disableCaching: false // explicitly set it to false, ServerProxy handles caching
                });
                Ext.Ajax.request(request);
                return request;
            }
        }
    });

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar