Results 1 to 3 of 3

Thread: How to pass complex types in DirectMethod?

  1. #1
    Ext JS Premium Member
    Join Date
    Mar 2008
    Posts
    34

    Default How to pass complex types in DirectMethod?

    Hello ExtJS Gurus.
    I need to pass complex objects to DirectMethod. For instance, I tried to pass Array instead of primitives in given examples but it failed with following error "System.Exception: Cannot create and populate list type System.Object."

    where the server code looks
    Code:
                    [DirectMethod]
    		public void SaveData(string[] names)
    		{
    and client code
    Code:
     CardService.SaveData(["Andrew","Golik"] , (function(e, result) {
    Should I make some mappings? or what?
    thanks in advance.

  2. #2

    Default

    AFAIK the standard PollingProvider does not support composite types. It shouldn't be too hard to add this to a custom PollingProvider though. The dispatcher on the server side needs modification as well, of course.

  3. #3
    Sencha User
    Join Date
    Feb 2009
    Posts
    38

    Default

    You can use JsonArray as argument type
    Code:
     [DirectMethod]
    public void SaveData(JsonArray jsonArray)
    {    
             Gson gson = new Gson(); 
          YourCustomClass obj = gson.fromJson(jsonArray, YourCustomClass.class);

Similar Threads

  1. A complex JSON data to map into complex form
    By TheItalianJob in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 26 Nov 2010, 7:53 AM
  2. New easing types
    By SamuraiJack1 in forum Community Discussion
    Replies: 7
    Last Post: 26 May 2009, 6:51 AM
  3. Designing for Complex Data/Complex Views
    By JEBriggs in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 5 May 2008, 12:17 PM
  4. Complex Layout, Complex Problem (for me)
    By mrras25 in forum Ext 1.x: Help & Discussion
    Replies: 3
    Last Post: 10 Dec 2007, 1:19 PM

Posting Permissions

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