[CLOSED] DirectMethod function: I wish cascading calls and receive returns.

  1. #1

    [CLOSED] DirectMethod function: I wish cascading calls and receive returns.

    Hi!

    I have a main page with two ext:panels. In each panel, I'm loading a page.
    The idea is that the first page contains filters and the second page contains a grid with data.
    I'd like that before grid refresh, is received the selected filters in filter page.

    But I do not know how to get the result of the function.
    I call the directMethod with Ext.Net.X.Js.Call.

    The grid Page call a directMethod function in Main Page and Main Page call a directMethod function in Filter Page.

    I don´t following the example in https://examples2.ext.net/#/Events/D...hods/Overview/ because I need that result is returned in a sub or function, because I need work over the return.

    I made a simple sample.

    Main Page (test50.aspx)
    <%@ Page Language="vb" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <script runat="server">
        <DirectMethod()>
        Public Function GetValueInTest50() As String
    
            Ext.Net.X.Msg.Alert("GetValueInTest50", "Here, I want call the directmethod function in Test51 aspx Page and and return the result to Test52 aspx Page.").Show()
            Return ""
        End Function
        
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Test 50</title>
    </head>
    <body>
        <ext:ResourceManager ID="resManagerExplorerWEB" runat="server" Locale="pt-BR" />
        <form id="form1" runat="server">
        <ext:Viewport runat="server" ID="viewPort2" Layout="BorderLayout">
            <Items>
                <ext:Panel ID="panelLeft" runat="server" Region="West" Flex="1" Width="300" MinWidth="300" MaxWidth="350" Split="true" layout="AnchorLayout" BodyPadding="0">
                    <Loader ID="loadFilter" runat="server" Mode="Frame" Url="test51.aspx">
                        <LoadMask ShowMask="true" Msg="Carregando..."/>
                    </Loader>
                </ext:Panel>
                <ext:Panel ID="panelCenter" runat="server" Region="Center" Flex="1" layout="FitLayout" BodyPadding="0">
                    <Loader ID="loadPanel" runat="server" Mode="Frame" Url="test52.aspx">
                        <LoadMask ShowMask="true" Msg="Carregando..."/>
                    </Loader>
                </ext:Panel>
            </Items>
        </ext:Viewport>
        </form>
    </body>
    </html>
    Page that needs the function value of directmethod function (test52.aspx)
    <%@ Page Language="vb" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <script runat="server">
        Protected Sub CallGetValueInTest50()
            
            'Ext.Net.X.Js.Call("parent.App.direct.GetFilter({success: function(result){ App.txtExternalFilter.setValue(result); alert(App.txtExternalFilter.getValue());}});")        
            
            Ext.Net.X.Msg.Alert("CallGetValueInTest50", "Here, I want call the directmethod function in Test50 aspx Page and receive the return of the function for set in lblResult.").Show()
            
        End Sub
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <ext:ResourceManager ID="resManagerExplorerWEB" runat="server" Locale="pt-BR" />
        <form id="form1" runat="server">
        <div>
        <ext:Viewport runat="server" ID="viewPort2" Layout="AbsoluteLayout">
            <Items>
                <ext:Label runat="server" ID="lblTitle" X="10" Y="5" Text="Test52 aspx Page"  />
                <ext:Button runat="server" ID="bt1" X="10" Y="45" Text="Call 'GetValue' in Test51.aspx page'" OnDirectClick="CallGetValueInTest50" />
                <ext:Label runat="server" ID="lblResult" X="10" Y="95" />
            </Items>
        </ext:Viewport>
        </div>
        </form>
    </body>
    </html>
    Page that contains the value to be rescued by directmethod function (test51.aspx)
    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Test51.aspx.vb" Inherits="WebApplication3.Test51" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <script runat="server">
        
        <DirectMethod()>
        Public Function GetValueInTest51() As String
            Return txt1.Text
        End Function
            
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Test 51</title>
    </head>
    <body>
        <ext:ResourceManager ID="resManagerExplorerWEB" runat="server" Locale="pt-BR" />
        <form id="form1" runat="server">
            <ext:Viewport runat="server" ID="viewPort2" Layout="AbsoluteLayout">
                <Items>
                    <ext:Label runat="server" ID="lblTitle" X="3" Y="5" Text="Test51 aspx Page"  />
                    <ext:Label runat="server" ID="lbl1" X="3" Y="45" Text="This page contains a directmethod function called 'GetValue' which should return the value of the textfield." />
                    <ext:TextField runat="server" ID="txt1" X="3" Y="105" FieldLabel="Source value" Text="50" />
                </Items>
            </ext:Viewport>
        </form>
    </body>
    </html>
    Last edited by geoffrey.mcgill; Apr 02, 2012 at 7:12 PM. Reason: [CLOSED]
  2. #2
    I am affraid that such scenarion is not supported by DirectMethods
    I suggest to use DirectMethod/DirectEvent when it is required only (when server side handling is required)
    Extract value from a field can be accomplished on the client side without direct method
  3. #3
    Is there any way I can do what I want?
  4. #4
    You have to do all on the client side (as much as possible), extracting field values, set text to label and etc, all of that can be accomplished on the client side via javascript

    DirectMethod si not designed to call another direct method
  5. #5
    I do not have experience in JavaScript, but I can find the web the commands.

    But I need a way or example on how to access the components of a page from another page, in cliente side.
  6. #6
    Quote Originally Posted by supera View Post
    But I need a way or example on how to access the components of a page from another page, in cliente side.
    Please see:
    https://examples2.ext.net/#/Panel/Ba...Communication/
  7. #7
    Ok! I try do this... thanks...

Similar Threads

  1. Replies: 7
    Last Post: Oct 21, 2014, 6:22 AM
  2. Prevent multiple calls to DirectMethod
    By glenh in forum 1.x Help
    Replies: 0
    Last Post: May 03, 2012, 12:00 AM
  3. Replies: 12
    Last Post: Mar 14, 2012, 7:10 PM
  4. Replies: 0
    Last Post: Jan 11, 2012, 8:30 AM
  5. Replies: 1
    Last Post: Jun 03, 2009, 12:10 PM

Posting Permissions