2

Lets say a user double click or right click on a pivot cell. How can I determine the location that has been selected ?

For instance, a user may want to select a location to reevaluate its position. Therefore, according to the location, I would need to send the corresponding book/region to the grid.

4

1 回答 1

1

您可以com.quartetfs.pivot.live.client.drillthrough.impl.DrillthroughExecutor.execute(IPivotDataCell, IMdxSelect, Cube, IMemberHasChildren, IMdxVisitorContext)用于此任务。这就是 Live 在内部用于钻取的内容。这可以IPivotCellContextHandler像这样完成:

@Override
    public void onPivotCellContext(PivotCellContextEvent event) {
        final IPivotCell pivotCell = event.getPivotCell();
        if(null != pivotCell && pivotCell instanceof IPivotDataCell) {
            //Show the context menu only for pivot-table data
            IPivotDataCell pivotDataCell = (IPivotDataCell) pivotCell;

            IMdxSelect select = event.getMdxModelPresenter().getMdxModel().getMdxSelect();
            Cube cube = event.getMdxModelPresenter().getMdxModel().getCube(); 
            FilterDescription fd = locationExtractor.execute(
                    pivotDataCell, 
                    select, 
                    cube, 
                    new MdxModelMemberHasChildren(event.getMdxModelPresenter().getMdxModel()),
                    new DefaultMdxVisitorContext(select, cube)
                );

// If filter description is too complicated we do not display the menu
            if (fd == null) {
                //TODO add entry in menu explaining that mdx is too complext to be converted to a location.
            }
            if (fd.getLocations().length != 1) {
                            //TODO handle, this should not happen but should be checked.
            }

然后您可以将fd.getLocations[0]其用于您的目的。

于 2013-09-23T09:22:33.373 回答