Announcement

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

    Destroy Hover Properly

    I'm trying to display a ListGrid as a hover component for a specific cell in another grid. I've overridden the getCellHoverComponent() method to achieve this and works no problem. Since the hover component is a grid, I've set setHoverAutoDestroy(false) on the hover ListGrid since it ends up destroying itself when the data arrives.

    Now I'm trying to figure out how to get rid of the hover. I added a kill function at the beginning of the getCellHoverComponent() method like this:

    Code:
        @Override
        protected Canvas getCellHoverComponent(final Record record, final Integer rowNum, final Integer colNum) {
            killHardwareSetHover();
            if (DSConst.OpeningSQL.HARDWARE_SET_ID.equals(getField(colNum).getName()) && record.getAttributeAsLong(DSConst.OpeningSQL.HARDWARE_SET_ID) != null) {
                hardwareSetHoverGrid = new HardwareSetHardwareGrid(record.getAttributeAsLong(DSConst.OpeningSQL.HARDWARE_SET_ID));
                return hardwareSetHoverGrid;
            } else {
                return super.getCellHoverComponent(record, rowNum, colNum);
            }
        }
    
        private void killHardwareSetHover() {
            if (hardwareSetHoverGrid != null) {
                hardwareSetHoverGrid.destroy();
            }
        }
    The above works assuming another hover is triggered. I've also used a com.google.gwt.user.client.Timer to get rid of the hover after a certain amount of time. That works, but I'd like the hover to stay if the user still has their mouse over the cell.

    Is there a better solution to this?

    #2
    It sounds like you just want to reverse your change to setHoverAutoDestroy(false). You've said something unclear about "ends up destroying itself when the data arrives" - we don't know what this means. The hover is destroyed when the hover is dismissed, data arrival won't dismiss the hover.

    Perhaps what you mean is that your hover dismisses when data is fetched, which could happen if you've left rpcRequest.promptStyle at the default setting, which blocks interactivity for the whole screen during the request, which would indeed dismiss a hover, immediately upon issuing the request.

    Comment


      #3
      Perfect! Exactly what I was looking for. DSRequest.setPromptStyle(PromptStule.CURSOR) fixed it. Much better solution, thank you.

      Maybe put a reference to that in the getCellHoverComponent() documentation.

      Comment


        #4
        We have updated the docs with that reference.

        Thanks for the suggestion.

        Regards
        Isomorphic Software

        Comment

        Working...
        X