Announcement

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

    CubeGrid custom menuItems for FacetValueContextClicks

    Using: SmartClient Version: SNAPSHOT_v12.1d_2019-07-10/PowerEdition Deployment (built 2019-07-10) w/ Chrome

    Following what I believe is the method eluded to in the CubeGrid.getDefaultFacetValueContextItems() documentation, I'm trying to add FacetValue dependent context menu options. This works for all facet values except for the those in the columns on the bottom, next to the body. For the basic cube grid example, this would be the revenue and profit FacetValues. For those values, a right click leads to an exception when super.getDefaultFacetValueContextItems() is called. I'm able to reproduce this on the Basic CubeGrid show case by overriding that method and adding the following context handler. This feels like a bug, or I'm completely misinterpreting the documentation. Hopefully you can straighten me out.

    Code:
     
    final CubeGrid cubeGrid = new CubeGrid() {
    
                @Override
                public MenuItem[] getDefaultFacetValueContextItems(FacetValueMap facetValues) {
    
                    List<MenuItem> menuItems = new ArrayList<>();
    
                    SC.logWarn("before super.getDefaultFacetValueContextItems() for facets:" + Arrays.toString(facetValues.getFacetIds()));
                    MenuItem[] items =  super.getDefaultFacetValueContextItems(facetValues);
                    SC.logWarn("after super.getDefaultFacetValueContextItems()");
    
                    menuItems.addAll(Arrays.asList(items));
    
                    MenuItem headerMenuItem = new MenuItem("I added this item");
                    headerMenuItem.setEnabled(false);
                    menuItems.add(headerMenuItem);
    
                    return menuItems.toArray(new MenuItem[menuItems.size()]);
                }
    
            };
            cubeGrid.addFacetValueContextClickHandler(new FacetValueContextClickHandler() {
    
                @Override
                public void onFacetValueContextClick(FacetValueContextClickEvent event) {
                    FacetValueMap facetValueMaps = event.getFacetValues();
                    MenuItem[] defaultMenuItems = cubeGrid.getDefaultFacetValueContextItems(facetValueMaps);
                    cubeGrid.setFacetValueContextItems(defaultMenuItems);
                }
            });
    The resulting log file for the offending right click shows:
    09:33:16.136:CXT9:WARN:Log:before super.getDefaultFacetValueContextItems() for facets:[quarter, month, metric]
    09:33:16.149:CXT9:WARN:Log:Uncaught Exception: Exception caught: (TypeError) : Cannot read property 'minimized' of undefined
    09:33:16.150:CXT9:WARN:Log:*************
    Stack Trace :

    09:33:16.152:CXT9:WARN:Log:Unknown.sMh_g$(Throwable.java:73)
    09:33:16.152:CXT9:WARN:Log:Unknown.YMh_g$(Exception.java:33)
    09:33:16.152:CXT9:WARN:Log:Unknown.eNh_g$(RuntimeException.java:33)
    09:33:16.153:CXT9:WARN:Log:Unknown.Etj_g$(UmbrellaException.java:65)
    09:33:16.153:CXT9:WARN:Log:Unknown.Ltj_g$(UmbrellaException.java:26)
    09:33:16.153:CXT9:WARN:Log:Unknown.Isj_g$(HandlerManager.java:129)
    09:33:16.153:CXT9:WARN:Log:Unknown.gd_g$(Widget.java:129)
    09:33:16.153:CXT9:WARN:Log:Unknown.anonymous(CubeGrid.java:2837)
    09:33:16.153:CXT9:WARN:Log:Unknown.nVh_g$(Impl.java:309)
    09:33:16.155:CXT9:WARN:Log:Unknown.qVh_g$(Impl.java:361)
    09:33:16.155:CXT9:WARN:Log:Unknown.anonymous(Impl.java:78)
    09:33:16.155:CXT9:WARN:Log:*************




    #2
    A fix to avoid the crash has been applied to the SGWT/SC 12.1d build and should be available in today's nightly builds dated 2019-09-13. It will also be ported back at least to the release SGWT/SC 12.0p shortly.

    Comment

    Working...
    X