[CLOSED] Call other window's method

  1. #1

    [CLOSED] Call other window's method

    Hi again.

    I have a GridPanel showing some data in a page.
    The grid is refreshed with a server Method (used in Store's OnRefreshData)

     Public Sub RefreshPhones(ByVal sender As Object, ByVal e As StoreRefreshDataEventArgs)
            RefreshPhones() 'This method gets data and databinds without problem
    
    
        End Sub
    or with a JS method:

    function RefreshGrid()
            
            {
                Ext.getCmp("grdPhones").store.reload();
                
            }
    To add/edit/delete a phone, a new window opens (Iframe mode).

    What I need is to call a refresh method from this opening window once the phone is added/edited/deleted, so the Phone list gets updated.

    I don't know if it's better to call the server method or client method from the iframe window before it closes, and don't know how in both cases.

    I saw IFrame communication sample, but I need communication between two windows, and can't get the opener just as I would do in regular Javascript.

    Also may help server side method calling, but don't know hoy to get the opened window instance to call the method.

    Thanks
    Regards
    Fernando
    Last edited by Daniil; Mar 14, 2012 at 4:04 PM. Reason: [CLOSED]
  2. #2
    Sorry.

    I can now reach the opener's method.
    If I alert it, it shows ok.

    alert(window.parent.parent.RefreshGrid);
    But I can't call it

    window.parent.parent.RefreshGrid();
    Nothing happens. (the method sucessfully refreshes the Grid when called locally)

    May be perhaps because I am on a modal window?

    Thanks
    Regards
    Fernando
  3. #3
    Hi,

    Also may help server side method calling, but don't know hoy to get the opened window instance to call the method.
    Well, when you call the Store reload method, it triggers its OnRefreshData handler to be executed.

    Generally, your code should work. Though I'm not sure how all is configured on your side.

    It would be best to look at a full sample which would reproduce the problem.
  4. #4
    I am so sorry Daniil
    It seems that today i got up more perceptive than yesterday ;-)

    I was calling an homonymous function of a "parent.parent" window ;-)

    It worked fine. I use the call in Success attribute of Save button's DirectEvent

    <ext:Button ID="btnSave" runat="server" Text="Save">
                        <DirectEvents>
                            <Click OnEvent="btnSave_Click" Success="window.parent.RefreshGrid();parentAutoLoadControl.close();">
                                <EventMask ShowMask="true" Msg="Saving..." />
                            </Click>
                        </DirectEvents>
                    </ext:Button>
    What seems curious for me is that a simple "parent" refers to the opener window, and there is no "opener" althought "this" is another aspx file loaded into an iframe window.

    Anyway, it is working now.

    Thanks
    Regards
    Fernando
  5. #5
    Quote Originally Posted by FAS View Post
    What seems curious for me is that a simple "parent" refers to the opener window, and there is no "opener" althought "this" is another aspx file loaded into an iframe window.
    I would be glad to clarify, but, I'm afraid, I don't understand your difficulty well.

    If you could demonstrate the problem with a simple sample, it would be great.
  6. #6
    Hi Daniil.

    There is no difficulty now.

    Your quoted text means what I thought before finding the way to call opener's window function.

    As it is another aspx file, loaded inside an iframe, loaded in another window I didn't imagine that a simple this.parent would refer to the opener. Today I tryied that and worked.

    Sorry about the confusion.

    You may close this thread.

    Thanks
    Regards
    Fernando
  7. #7
    Understand, thanks for the clarification.

Similar Threads

  1. Replies: 1
    Last Post: May 29, 2013, 6:00 PM
  2. [CLOSED] DirectEvents call method codebehind
    By rnfigueira in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Sep 05, 2011, 3:03 PM
  3. [CLOSED] Call Method using Remote Paging
    By speedstepmem4 in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Dec 16, 2010, 12:27 PM
  4. How to call serverSide method from javascript
    By designworxz in forum 1.x Help
    Replies: 2
    Last Post: Mar 09, 2009, 11:26 PM
  5. method call
    By mono in forum 1.x Help
    Replies: 1
    Last Post: Mar 09, 2009, 6:46 AM

Tags for this Thread

Posting Permissions