Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    13.0d Menu with hover - shouldShowIconField is not a function ex

    Hi,
    If you modify 13.0d Showcase example: https://www.smartclient.com/smartcli...e/?id=fullMenu
    to display hover on menu items:
    Code:
    isc.Menu.create({
        ID: "menu",
        autoDraw: false,
        showShadow: true,
        shadowDepth: 10,
        data: [
            {title: "New", keyTitle: "Ctrl+N", icon: "icons/16/document_plain_new.png"},
            {title: "Open", keyTitle: "Ctrl+O", icon: "icons/16/folder_out.png"},
            {isSeparator: true},
            {title: "Save", keyTitle: "Ctrl+S", icon: "icons/16/disk_blue.png"},
            {title: "Save As", icon: "icons/16/save_as.png"},
            {isSeparator: true},
            {title: "Recent Documents", icon: "icons/16/folder_document.png", submenu: [
                {title: "data.xml", checked: true},
                {title: "Component Guide.doc"},
                {title: "SmartClient.doc", checked: true},
                {title: "AJAX.doc"}
            ]},
            {isSeparator: true},
            {title: "Export as...", icon: "icons/16/export1.png", submenu: [
                {title: "XML"},
                {title: "CSV"},
                {title: "Plain text"}
            ]},
            {isSeparator: true},
            {title: "Print", enabled: false, keyTitle: "Ctrl+P", icon: "icons/16/printer3.png"}
        ],
        canHover: true,
        showHoverComponents: true,
        rowHover: function(record, rowNum, colNum) {return "aaa";}
    });
    
    var menuButton = isc.MenuButton.create({
        ID: "menuButton",
        autoDraw: false,
        title: "File",
        width: 100,
        menu: menu
    });
    
    isc.HStack.create({
        width: "100%",
        members: [menuButton]
    });
    then hover is not shown and this js ex could be found on the dev console:
    Code:
    12:53:37.281:TMR5:WARN:Log:TypeError: _1.shouldShowIconField is not a function
    Stack from error.stack:
        showIf()
        DetailViewer.fieldShouldBeVisible()
        DetailViewer._getVisibleFields()
        Canvas.getVisibleFields()
        DetailViewer.deriveVisibleFields()
        DetailViewer.setFields()
        DetailViewer.initWidget()
        Canvas.init()
        Class.createAutoChild()
        ListGrid._getStockEmbeddedComponent()
        ListGrid.getCellHoverComponent()
        ListGrid._getCellHoverComponent()
        GridBody._getCellHoverComponent()
        GridRenderer._showHover()
        GridRenderer._cellHover()
        [c]Hover.setAction()
        GridRenderer.mouseMove()
        Canvas.handleMouseMove()
        [c]EventHandler.bubbleEvent()
        EventHandler.._handleMouseMove()
        EventHandler._handleMouseMove()
        EventHandler._delayedMouseMove()
        [c]Class.fireCallback()
        Timer._fireTimeout()
        Timer.setTimeout/_6<()
    Thanks,
    MichalG

    #2
    Hi,
    Is it reproducible?
    Thanks,
    MichalG

    Comment


      #3
      Hi Michael
      The problem comes from having showHoverComponents: true on the menu. The default fields for a Menu don't support the default HoverMode of "details", which leads to the JS error you saw.
      We're looking at whether we can better handle this, but the more fundamental question here is - what are you trying to achieve?

      It looks like you actually just want custom hover text for your menu items? If this is the case you can get rid of showHoverComponents, and replace your rowHover function with a cellHoverHTML implementation that returns the text you want to see.

      Let us know if this doesn't get things working for you, or you're looking to achieve something else

      Thanks
      Isomorphic Software

      Comment


        #4
        You are right:
        It looks like you actually just want custom hover text for your menu items? If this is the case you can get rid of showHoverComponents, and replace your rowHover function with a cellHoverHTML implementation that returns the text you want to see.
        Your suggestion is working fine for me.
        I just wonder that using showHoverComponents:true used to work (meaning not throw ex) in SGWT v12.1p_2020-06-19.
        Thank you,
        MichalG

        Comment


          #5
          We'll be making a change to avoid the exception with showHoverComponents:true soon.

          Comment


            #6
            The issue that could cause crashes when a Menu tried to show builtin DBC-based hoverComponents (in this case DetailViewer) has been addressed for builds dated December 3 and later.

            Comment

            Working...
            X