Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
245
Web Tab - Call javascript inside a tab linked page
posted

Hi everyone,

I have a problem for upgrade a (very complex) application from the old infragistics library (version 10) to the new ones.

I have an environment with 2 iframes (Menu and Funz)

In iframe (Menu) I have a WebTab (TabMenu) with 3 tabs, in the other iframe (Funz) I have a webdatagrid and a button.

The WebTab loads three aspx pages: menu1.aspx / menu2.aspx 3 menu3.aspx.

Clicking on the button, in addition to the postback of the iframe (funz) I reached the page (menu2.aspx) inside Tab (2) and updated it by calling a javascript contained inside a page (menu2.aspx).

With infragistics version 10, in the button OnClick event (server side)  I updated some session variable and recorded a javascript:

<script language = "javascript" type = "text / javascript">

   function RefreshMenu2 () {

      var Menu2;    // content of menu2.aspx

     Menu2 = top.Menu.document.getElementById ("TabMenu_frame1");

     Menu2.contentWindow.RefreshCUS ();

}

</script>

The script ran the javascript RefreshCUS ()  (on menu2.aspx) which performed a _doPostback () and re-read the new session data by reconstructing a list. This function, in practice, was used to move selected records on a webdatagrid in an iframe to another webdatagrid on the other iframe. 

Now, with Infragistics 20.x I can no longer get the menu2.aspx page for call the javascript that it contains due to the new structure of WebTab.

Anyone have a suggestion?

Thank you

Parents
No Data
Reply
  • 29417
    Verified Answer
    Offline posted

    Hello Andrea,

    Thank you for posting in our forum.

    You could get and store the WebTab client object on the related window when the Tab loads, for example:

    Tab definition:
    <ig:WebTab ID="TabMenu" runat="server” …>
    <ClientEvents Loaded="TabMenu_Loaded" />
    ….

    Client script:

    <script type="text/javascript" id="igClientScript">

    function TabMenu_Loaded(sender, eventArgs)
    {
    window.WebTab = sender;
    }

    </script>

    And use its API to get the children frames, for example:

    <script>
    function Button_Click() {
    var MenuFrameWindow = top.Menu.contentWindow;
    var WebTab = MenuFrameWindow.WebTab;
    var frame = WebTab.getTabAt(0).get_iframe();
    }
    </script>

    Using the public API will ensure you can get the correct iframes even if their inner implementation (like their assigned ids) change between versions.

    Let me know if that would solve your issue.

    Regards,
    Maya Kirova

Children