1. #11
    Sencha - Services Team
    Join Date
    Mar 2007
    Location
    Foristell, MO
    Posts
    1,107
    Answers
    12
    Vote Rating
    3
    jratcliff is on a distinguished road

      0  

    Default


    So it seems when I am using the proxy I am not encoding the extraParams properly as json and we are getting a couple of extra params as well (i.e. page, start, and limit). I have tried to set the pageParams, startParams, and limitParams properties to undefined as the docs say and I have also tried specifying the writer property to json. Neither worked.
    Are you sure you correctly set the pageParam, startParam and limitParam to undefined? I just tried it and it worked for me.

    Code:
    Ext.define('app.store.Things', {
        autoLoad: true,
        extend: 'Ext.data.Store',
        model: 'app.model.Thing',
        proxy: {
    
            pageParam : undefined,
            startParam : undefined,
            limitParam : undefined,
    
            actionMethods: {
                create: 'POST',
                read: 'POST',
                update: 'POST',
                destroy: 'POST'
            },
            headers: {
                'Content-Type': 'application/json; charset=utf-8'
            },
            reader: {
                type: 'json',
                root: 'd'
            },
            extraParams: {
                id: '',
                token: '',
                filter: ''
            },
            type: 'ajax',
            url: 'http://...service.asmx/GetThings',
        }
    });
    Jack Ratcliff
    Sencha Inc, Green bleeding Senchan

    How to report a bug:
    http://www.sencha.com/forum/showthre...o-report-a-bug

  2. #12
    Sencha User
    Join Date
    Nov 2011
    Posts
    16
    Answers
    1
    Vote Rating
    0
    michaelreneer is on a distinguished road

      0  

    Default


    Quote Originally Posted by jratcliff View Post
    Are you sure you correctly set the pageParam, startParam and limitParam to undefined? I just tried it and it worked for me.
    Whoops I was using plural properties. At least this part is fixed


    Quote Originally Posted by tvanzoelen View Post
    Well why don't try to do first the same with the store

    extraParams: Ext.JSON.encode({
    id: '',
    token: '',
    filter: ''
    }),
    Yep tried that. Didn't work. The response when I try and encode the extraParams is:

    Code:
    Request URL:http://...service.asmx/GetThings
    Request Method:POST
    Status Code:500 Internal Server Error
    Request Headers
    
    
    Content-Type:application/json; charset=UTF-8
    Origin:file://
    User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/534.51.22 (KHTML, like Gecko) Version/5.1.1 Safari/534.51.22
    X-Requested-With:XMLHttpRequest
    
    
    Request Payload
    0=%7B&1=%22&2=i&3=d&4=%22&5=%3A&6=%22&7=%22&8=%2C&9=%22&10=t&11=o&12=k&13=e&14=n&15=%22&16=%3A&17=%22&18=%22&19=%2C&20=%22&21=f&22=i&23=l&24=t&25=e&26=r&27=%22&28=%3A&29=%22&30=%22&31=%7D
    Response Headers
    
    
    Cache-Control:private
    Content-Length:91
    Content-Type:application/json; charset=utf-8
    Date:Mon, 07 Nov 2011 23:59:58 GMT
    jsonerror:true
    Server:Microsoft-IIS/7.5
    X-AspNet-Version:4.0.30319
    X-Powered-By:ASP.NET
    So I ultimately it seems am still unable to correctly encode the payload as json. Thanks again for all the help to this point. I am still wondering if I should be using a different type of proxy.

    Thanks for any additional help.

  3. #13
    Sencha - Services Team
    Join Date
    Mar 2007
    Location
    Foristell, MO
    Posts
    1,107
    Answers
    12
    Vote Rating
    3
    jratcliff is on a distinguished road

      0  

    Default


    Why again are you using Ext.Json.encode? extraParams expects an object and Ext.Json.encode returns a string.
    Jack Ratcliff
    Sencha Inc, Green bleeding Senchan

    How to report a bug:
    http://www.sencha.com/forum/showthre...o-report-a-bug

  4. #14
    Ext JS Premium Member tvanzoelen's Avatar
    Join Date
    Apr 2008
    Location
    Groningen - Netherlands
    Posts
    1,108
    Answers
    83
    Vote Rating
    31
    tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about

      0  

    Default


    Probably the server part expects a JSON format.

    So ,what if you set

    writer: 'json'

    on the proxy?

  5. #15
    Sencha User
    Join Date
    Nov 2011
    Posts
    16
    Answers
    1
    Vote Rating
    0
    michaelreneer is on a distinguished road

      0  

    Default


    Quote Originally Posted by jratcliff View Post
    Why again are you using Ext.Json.encode? extraParams expects an object and Ext.Json.encode returns a string.
    I wasn't as that was my interpretation of the documentation as well. I was trying it on tvanzoelen suggestion.


    Quote Originally Posted by tvanzoelen View Post
    Probably the server part expects a JSON format.

    So ,what if you set

    writer: 'json'

    on the proxy?
    This is correct. I tried that as well, but now that I think about it when I was trying that I was also spelling the xyzparam properties wrong. Let me give that a try and I will post back the response I am getting.

  6. #16
    Sencha User
    Join Date
    Nov 2011
    Posts
    16
    Answers
    1
    Vote Rating
    0
    michaelreneer is on a distinguished road

      0  

    Default


    Setting the writer on the proxy to 'json' doesn't appear to work either. I am getting a payload of:

    id=&token=&filter=
    At least I seem to be approaching the right question to ask: how do you configure the proxy of a store to send the parameters as json?

  7. #17
    Ext JS Premium Member tvanzoelen's Avatar
    Join Date
    Apr 2008
    Location
    Groningen - Netherlands
    Posts
    1,108
    Answers
    83
    Vote Rating
    31
    tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about

      0  

    Default


    Setting the writer to JSON I think. Maybe this is something for the department 'BUG'

    As alternative solution you can also set params in the call of the load function.

  8. #18
    Sencha User
    Join Date
    Nov 2011
    Posts
    16
    Answers
    1
    Vote Rating
    0
    michaelreneer is on a distinguished road

      0  

    Default


    Quote Originally Posted by tvanzoelen View Post
    Setting the writer to JSON I think. Maybe this is something for the department 'BUG'

    As alternative solution you can also set params in the call of the load function.
    So I did try that but the documentation wasn't clear.

    When I call load() method on a store I can pass an Ext.data.Operation object into that method. But I didn't see anywhere on the Operation object to configure the parameters. Any advice on how to do that?

  9. #19
    Ext JS Premium Member tvanzoelen's Avatar
    Join Date
    Apr 2008
    Location
    Groningen - Netherlands
    Posts
    1,108
    Answers
    83
    Vote Rating
    31
    tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about

      0  

    Default


    load({params: anarray})

  10. #20
    Sencha User
    Join Date
    Nov 2011
    Posts
    16
    Answers
    1
    Vote Rating
    0
    michaelreneer is on a distinguished road

      0  

    Default


    Ok I was able to finally get everything working. After trying a combination of the above suggestions. First my store:

    Code:
    Ext.define('app.store.Things', {
    	extend: 'Ext.data.Store',
    	model: 'app.model.Thing',
    	proxy: {
    		actionMethods: {
    			create: 'POST',
    			read: 'POST',
    			update: 'POST',
    			destroy: 'POST'
    		},
    		headers: {
    			'Content-Type': 'application/json; charset=utf-8'
    		},
    		reader: {
    			type: 'json',
    			root: 'd'
    		},
    		type: 'ajax',
    		url: 'http://...service.asmx/GetThings',
    	}
    });
    A couple of things to note:
    1) The stores autoLoad property is not set, thus defaulting to false.
    2) I didn't need to set any of the xyzparam properties to undefined.
    3) I didn't need to set the writer property.

    Then you need to call the load method on the store and encode the parameters. In my example this was in the controllers init method:

    Code:
    Ext.define('app.controller.Thing', {
    	extend: 'Ext.app.Controller',
    	models: ['Thing'],
    	stores: ['Things'],
    	...
    	init: function(application) {
    
    		...
    		this.getThingsStore().load({
    			params: Ext.JSON.encode({
    				id: '',
    				token: '',
    				filter: ''
    			})
    		});
    	}
    });
    A couple of thoughts:
    1) It seems like setting the writer to 'json' should have solved the problem by my interpretation of the documentation. Is this true? And if so should I file a bug? And where? Sorry for being new to the forums
    2) I could not find documentation on passing parameters like you suggested into the load method. Is this because this is a deprecated property on the Ext.data.Operation object? Or is the documentation not complete?
    3) Should I mark this post as the most correct answer as it is the most complete, or should I mark the suggestion above as the correct one that lead me to the solution? I am not sure if you are supposed to mark your own posts as the answer.

    Again, thank you very much for all the help.

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