[CLOSED] [#636] Difference between DirectMethod request params and Ajax request params

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] [#636] Difference between DirectMethod request params and Ajax request params


    I think Arrays are not being submitted in the same way for DirectMethod requests as they are for Ajax requests:

    Consider this (the URL that direct method or ajax request is going to doesn't matter - it can fail, it is the HTTP post that is significant)

    var params = {
      a: 1,
      b: [1, 2, 3]
    Now, if I submit via direct method:

      url: '/does/not/matter',
      cleanRequest: true,
      params: params
    Look at the HTTP request, and you will see params are sent like this:

    a 1
    b [1,2,3]

    Now if you run the same with Ajax:

        url: '/does/not/matter',
    You get this:

    a 1
    b 1
    b 2
    b 3

    This is quite significant for me in a certain scenario.

    Is there any way Direct Method can be configured to send params in the way that Ext.Ajax.request is doing when using params when some of the params (complex objects) contains arrays?

    Reason this is important for me is that it makes it consistent, especially for those coming in from a pure Ext JS background and also works better with ASP.NET MVC Controllers that use plain old C# objects as controller argument. In other words the type of the argument is a class that has many properties including things like List<int> in the type definition. ASP.NET MVC automatically binds such variables to these if they are sent, as seen by the Ext.Ajax.request approach. When I am using a DirectMethod like above it becomes null because MVC cannot deserialize.

    To clarify, if I have a C# object like this:

    public class MyClass
        int a { get; set; }
        List<int> b { get; set; }
    Then my Controller signature can take an argument of type MyClass as the parameter, but b will be null...
    Last edited by Daniil; Jan 17, 2015 at 10:43 AM. Reason: [CLOSED]

Similar Threads

  1. Replies: 2
    Last Post: Oct 10, 2014, 8:50 AM
  2. Replies: 13
    Last Post: May 16, 2011, 1:26 PM
  3. [CLOSED] Adding params as jsonData for jsin Ajax requests
    By r_honey in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: May 06, 2010, 7:31 AM
  4. Ext.net.DirectMethod.request PARAMS
    By sipo in forum 1.x Help
    Replies: 0
    Last Post: Apr 15, 2010, 5:06 AM
  5. Page_ Ajax Load Complete BUG on Ajax Request
    By jeybonnet in forum 1.x Help
    Replies: 8
    Last Post: Jun 22, 2009, 11:19 AM

Posting Permissions