[CLOSED] Extending DirectMethod for cross-posting

  1. #1

    [CLOSED] Extending DirectMethod for cross-posting

    So, first thing I'd like to do is extend DirectMethods with different default parameters for shorthand. To do that, DirectMethod must not be internal.

    The second thing may be an issue or a request. The issue is that when I make a DirectMethod public via IDMode = DirectMethodProxyIDMode.None, I expect the Control that the DirectMethod originates not to matter as long as it finds it in the global list. The problem is I'm cross-posting between pages now and I originate in a DirectMethod that appears in a UserControl, but on post to the next page, it's in the Page Level. The RaisePostBack eventArgument is cp_ctl05|public|EventPageRefresh but it need to be -|public|EventPageRefresh to find it.

    So either I need a way to override the ControlID in the DirectMethod, or I need the RaisePostBackEvent for requestType==public to disregard the controlid it originated. I prefer the latter but either option would be fine.
    Last edited by Daniil; Feb 18, 2014 at 3:43 AM. Reason: [CLOSED]
  2. #2
    Sorry, I am not sure how direct method proxy is generated for direct method on one page is related with direct method on another page
    How do you call direct method using proxy method from different page?

    In any way, you can direct method without any proxy (it is not desired way but it is possible, just see which proxy methods are generated by Ext.Net for your direct method)
    Ext.net.DirectMethod.request("MethodName", {/*arguments here*/});
  3. #3
    What about my first request to make DirectMethod a public class so it can be extended?

    Quote Originally Posted by Vladimir View Post
    Sorry, I am not sure how direct method proxy is generated for direct method on one page is related with direct method on another page
    How do you call direct method using proxy method from different page?
    My personal implementation is found in the javascript section here:
    http://forums.ext.net/showthread.php...n-Fields/page2

    But to break it down, it's simply done this way:
    document.forms[0].action=url
    I believe I saw somewhere where DirectEvents allow a different post url as well.

    Quote Originally Posted by Vladimir View Post
    In any way, you can direct method without any proxy (it is not desired way but it is possible, just see which proxy methods are generated by Ext.Net for your direct method)
    Ext.net.DirectMethod.request("MethodName", {/*arguments here*/});
    I prefer to continue to use the proxy because eventually I'll need to be able to turn this code over to other developers who won't be as savvy about dealing with some of the subtleties, and it's easier to show by example if there's an attribute I can specify.

    Is there any technical reason why another property (say MakeGlobal) for DirectMethod cannot be specified as bool to identify a global reference that when true will be substituted to DirectMethodBuilder instead of the controlid for constructing the proxy for the client? Say example, "-global". Then id is "-global" instead, RaisePostBackEvent will look up "-global" instead as the key instead of the clientid of the control?
    Last edited by michaeld; Feb 07, 2014 at 3:23 AM.
  4. #4
    DirectMethod proxy is designed to call own direct method handler on the server side, I am not sure why direct method is declared inside one control should generates proxy to call another direct method. It is very strange case (and not good, imho). I guess we will no add such functionality. If you need such strange behaviour then use 'Ext.net.DirectMethod.request' calling, you can prevent proxy generation for particular direct mewthod (ClientProxy property of DirectMethodAttribute) and create that proxy manually:
    Ext.ns("App.direct");
    Ext.apply(App.direct, {    
        LogCompanyInfo: function (name, count, config) {
            return Ext.net.DirectMethod.request("LogCompanyInfo", {
                params: {
                    name: name,
                    count: count
                }
            });
        }
    });
    Is there any technical reason why another property (say MakeGlobal) for DirectMethod cannot be specified as bool to identify a global reference
    Why do you declare direct method inside a control instead page in this case?
  5. #5
    Quote Originally Posted by Vladimir View Post
    DirectMethod proxy is designed to call own direct method handler on the server side, I am not sure why direct method is declared inside one control should generates proxy to call another direct method. It is very strange case (and not good, imho). I guess we will no add such functionality. If you need such strange behaviour then use 'Ext.net.DirectMethod.request' calling, you can prevent proxy generation for particular direct mewthod (ClientProxy property of DirectMethodAttribute) and create that proxy manually:
    Ext.ns("App.direct");
    Ext.apply(App.direct, {    
        LogCompanyInfo: function (name, count, config) {
            return Ext.net.DirectMethod.request("LogCompanyInfo", {
                params: {
                    name: name,
                    count: count
                }
            });
        }
    });
    Why do you declare direct method inside a control instead page in this case?
    Simply a scoping issue. I have a page that loads a user control based upon the currently selected view. The usercontrol has the scope of the container that needs to rerendered. Sometimes I replace it with the same DirectMethod in the different usercontrol (unrelated to cross-posting scenario). I'm pretty sure at one time, this used to work. I don't know if it's related to changes made in Ext.Net.Utilities.FindControls. When the DirectMethod Attribute was set to IDMode=DirectMethodProxyIDMode.None, it used to not matter which control the DirectMethod was apart. It would find the DirectMethod regardless of the UserControl or page it was in.
  6. #6
    When the DirectMethod Attribute was set to IDMode=DirectMethodProxyIDMode.None, it used to not matter which control the DirectMethod was apart. It would find the DirectMethod regardless of the UserControl or page it was in.
    That property affects on proxy name only (generate proxy method name without ClientID in the name). It doesn't affect on searching direct method in the server side. Proxy method is designed to call own method only, it should not call anything else. If you need to call another method then use 'Ext.net.DirectMethod.request'

Similar Threads

  1. [CLOSED] How to cross link threads?
    By jwf in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Nov 15, 2012, 10:38 PM
  2. [CLOSED] Cross-page Postback
    By alliedwallet.com in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Oct 16, 2011, 1:19 PM
  3. [CLOSED] Cross-window Development
    By jamesnw in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 06, 2011, 5:20 PM
  4. [CLOSED] TableLayout cross browser problem
    By kenanhancer in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jan 13, 2011, 10:24 AM
  5. to cross a TreePanel
    By miguelp120 in forum 1.x Help
    Replies: 0
    Last Post: Jan 27, 2010, 5:16 PM

Posting Permissions