1. #1
    Ext JS Premium Member
    Join Date
    Nov 2009
    Location
    San Diego, CA
    Posts
    158
    Vote Rating
    0
    locutusUT is on a distinguished road

      0  

    Default ScriptTagProxy not taking extra params

    ScriptTagProxy not taking extra params


    It looks like in 4, you use extraParams to define additional params for a JSONP URL, but for some reason, I don't see them in the debugger which leads me to believe that is the reason my store lookup is failing.

    Is there something amiss in what I have here for this version? I currently do not see any results from this json:

    Ext.util.JSONP.callback(
    {
    response: "{"records":{"record":[{..JSON DATA HERE...}]}}
    }

    Code:
        var store = Ext.create('Ext.data.Store', {
            model: 'Writer.CVL',
            autoLoad: true,
            autoSync: false,
            proxy: {
                type: 'scripttag',
                url: 'http://mashup/presto/edge/api/rest/Writeback_Test/findCvlDashboardDataAll',
                callbackParam: 'callback',
                extraParams: {
    				'x-presto-resultFormat': 'json',
    				'limit': '20',
    				'x-p-anonymous': 'true'
                },
                api: {
                    read: 'http://mashup/presto/edge/api/rest/Writeback_Test/findCvlDashboardDataAll'
                },
                reader: {
                    type: 'json',
                    successProperty: 'success',
                    root: 'records',
                    messageProperty: 'message'
                },
                writer: {
                    type: 'json',
                    writeAllFields: false,
                    root: 'records.record'
                },
    	    callback: function(result) {
    	    	console.log("result?");
    	    },
                listeners: {
                    exception: function(proxy, response, operation){
                        Ext.MessageBox.show({
                            title: 'REMOTE EXCEPTION',
                            msg: operation.getError(),
                            icon: Ext.MessageBox.ERROR,
                            buttons: Ext.Msg.OK
                        });
                    }
                }
            },
            listeners: {
                write: function(proxy, operation){
                    Ext.example.msg(operation.action, operation.resultSet.message);
                }
            }
        });

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,856
    Vote Rating
    610
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    This example uses extraParams with a jsonp proxy: http://dev.sencha.com/deploy/ext-4.0...rum/forum.html
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Ext JS Premium Member
    Join Date
    Nov 2009
    Location
    San Diego, CA
    Posts
    158
    Vote Rating
    0
    locutusUT is on a distinguished road

      0  

    Default


    Yes, I see that and as in the example code I shared, I have that set as well. I should be able to use scriptagproxy much like I did in 3.3. Is something amiss in how I have it configured for 4?

  4. #4
    Ext JS Premium Member
    Join Date
    Nov 2009
    Location
    San Diego, CA
    Posts
    158
    Vote Rating
    0
    locutusUT is on a distinguished road

      0  

    Default


    So I debugged this down into the ExtJS code and I think I found a bug. It appears that this function is looking for response.responseText rather than just response.response (i.e., there is no responseText in the response object):

    Code:
    LINE 15274 - BETA3
      read: function(response) {
            var data = response;
            
            if (response && response.response) {
                data = this.getResponseData(response);
            }
            
            if (data) {
                return this.readRecords(data);
            } else {
                return this.nullResultSet;
            }
        },
    LINE 32006 - BETA3
        getResponseData: function(response) {
            try {
                var data = Ext.decode(response.response);
            }
            catch (ex) {
                Ext.Error.raise({
                    response: response,
                    json: response.response,
                    parseError: ex,
                    msg: 'Unable to parse the JSON returned by the server: ' + ex.toString()
                });
            }
            if (!data) {
                Ext.Error.raise('JSON object not found');
            }
    
            return data;
        },
    I'll report this as a bug.

Similar Threads

  1. How to get params to ScriptTagProxy used by ListStore
    By taggart in forum Ext GWT: Discussion
    Replies: 0
    Last Post: 19 Oct 2009, 2:42 PM
  2. grid taking old params after reload the store
    By Abisha in forum Ext 2.x: Help & Discussion
    Replies: 7
    Last Post: 2 Jun 2009, 8:40 PM
  3. scripttagproxy & those extra parameters
    By cupofjava in forum Ext 2.x: Help & Discussion
    Replies: 9
    Last Post: 22 Jan 2008, 9:58 AM
  4. Extra Params in Connection
    By seancallan in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 6 Dec 2007, 12:55 PM
  5. params with ScriptTagProxy or HttpProxy
    By devil1591 in forum Ext 2.x: Help & Discussion
    Replies: 9
    Last Post: 3 Dec 2007, 11:22 AM

Thread Participants: 1