Client side events

8 posts, 0 answers
  1. Solgenia
    Solgenia avatar
    11 posts
    Member since:
    Sep 2009

    Posted 18 May 2010 Link to this post

    Hi, I am facing a strange issue with RadMenu.
    I set an OnClientItemClicking javascript function that gets correctly called in FireFox but does nothing in IE8 (if I put an alert in there it is not shown).
    Is there any way I can debug this issue?
    Thanks
    Luca
  2. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 19 May 2010 Link to this post

    Hello Solgenia,

    I created a sample project to test your case. Alert message in OnClientItemClicking handler appears on IE8, IE7, IE8 Compatibility View and Mozilla Firefox.

    In the ticket info I see that you have specified Version 2010.1.415 of the controls. If that's not the case, please tell me which version you use. Also, sending the code that you are using will be helpful for resolving the issue quickly.

    Thank you.

    You may find the sample project in the attached .zip file.

    Kind regards,
    Veronica Milcheva
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Solgenia
    Solgenia avatar
    11 posts
    Member since:
    Sep 2009

    Posted 19 May 2010 Link to this post

    Hi Veronica, thanks for your answer but I am looking for some hints on how to debug this issue. I know RadMenu is fully functional within all the browsers you mentioned, and all the samples work fine.
    I actually did not specify a version, I am currently using the 429 internal build. I also tried the plain Q1 2010 with the same results.
    The OnClientItemClicking javascript function is not executed (or the OnClientItemClicked).
    The JS function is pretty simple, I paste it below
    function onMenuClicking(sender, eventArgs) 
            { 
                var item = eventArgs.get_item(); 
                 
                var url = item.get_navigateUrl(); 
                if (url=="#") 
                    url = item.get_value(); 
                if ((url) && (url.toLowerCase().substr(0,11) != "javascript:")) 
                { 
                    WindowManager.open(url, null, null, null); 
                    eventArgs.get_domEvent().preventDefault(); 
                } 
            } 
    This is the RadMenu declaration
    <telerik:RadMenu ID="mnuMain" runat="server" Width="100%" onclientitemclicking="onMenuClicking" style="z-index:10000;"
                            </telerik:RadMenu> 
    The menu is loaded from the following XML
    <?xml version="1.0" encoding="utf-16"?> 
    <Menu skin="Sunset"
        <Group Flow="Horizontal"
            <Item Text="File" NavigateUrl="" Value=""
                <Group Flow="Vertical"
                    <Item Text="Settings" NavigateUrl="" Value=""
                        <Group Flow="Vertical"
                            <Item Text="VoIP" NavigateUrl="" Value="VOIPSettings.aspx" /> 
                            <Item Text="Currency" NavigateUrl="" Value="Currency.aspx" /> 
                        </Group> 
                    </Item> 
                    <Item Text="My Report" NavigateUrl="" Value="MyReport.aspx" /> 
                </Group> 
            </Item> 
            <Item Text="Basic" NavigateUrl="" Value=""
                <Group Flow="Vertical"
                    <Item Text="Groups" NavigateUrl="DatiBase.aspx?db=Gruppo" Value="DDB_GRUPPO" /> 
                    <Item Text="Actions" NavigateUrl="" Value="Actions.aspx" /> 
                </Group> 
            </Item> 
            <Item Text="Help" NavigateUrl="" Value=""
                <Group Flow="Vertical"
                    <Item Text="About" NavigateUrl="javascript:WindowManager.openDialog(null, 'Informations.aspx', 'Blix Web Sales',500,630,'','',false)" Value="" /> 
                </Group> 
            </Item> 
        </Group> 
    </Menu> 
    The items that have a NavigateUrl set are executed (for example, the About or Groups items), the others are not (for example, Currency).
    Everything is correctly executed in FF, I'd like to know how I can debug the RadMenu JS code that is supposed to handle the OnClientItemClicking function. Also, is there any chance that the RadMenu emits different code for each browser based on the various settings?
    Thanks
    Luca


     
  4. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 20 May 2010 Link to this post

    Hello Luca,

    The reason for which the "About" and "Groups" opened new windows successfully was because when you set the NavigateUrl property to some url and click on the item, it redirects directly to this url and ignores the NodeClicking or NodeClicked events.

    The reason why items which have their urls stored in Value property not to open new windows was because of this line:

    WindowManager.open(url, null, null, null);

    I suggest you use standard window.open function fully described here:

    function onMenuClicking(sender, eventArgs) {
                var item = eventArgs.get_item();
      
                var url = item.get_navigateUrl();
                if (url == "#") {
                    url = item.get_value();
                }
                if ((url) && (url.toLowerCase().substr(0, 11) != "javascript:")) {
                    window.open(url, "mywindow");
                    eventArgs.get_domEvent().preventDefault();
                }
            }

    Find the full code in the attached .zip file.

    Hope this helps.

    Regards,
    Veronica Milcheva
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. Solgenia
    Solgenia avatar
    11 posts
    Member since:
    Sep 2009

    Posted 20 May 2010 Link to this post

    Hi, Veronica, thanks for your answer but the problem does not lie in the function body itself.
    The problem is that the function in not  called at all. And the WindowManager is a JS class we wrote to handle application windows (there's no relation with the window DOM object).
    I can change the function this way
    function onMenuClicking(sender, eventArgs)  
       alert("clicking"); 
    But in IE I do not see the alert at all.

    Luca
  6. Solgenia
    Solgenia avatar
    11 posts
    Member since:
    Sep 2009

    Posted 24 May 2010 Link to this post

    I understand you have plenty of questions, but can you just point us in the right direction?
    I just need info on how to debug the issue. Is there a particular IE addin we can use? Which object/method should we look into?
    Thanks
    Luca
  7. Solgenia
    Solgenia avatar
    11 posts
    Member since:
    Sep 2009

    Posted 24 May 2010 Link to this post

    Solved.
    We were adding an indexOf method to the Array class that was breaking the menu functionality. Found it using the cool debugger extension of IE8.

    Luca
  8. Morten
    Morten avatar
    351 posts
    Member since:
    Jul 2012

    Posted 13 Oct 2010 Link to this post

    I get this too when there is a bug in my javascript. FF and Chrome seem to handle some js error that IE8 does not.
Back to Top