Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

TileGrid Component Hover

$
0
0
Has anyone managed to get the hoverComponent to work with a TileGrid? I've made use of the following:

Code:

@Override
public Canvas getHoverComponent() {
    Record record = tileGrid.getSelectedRecord();
    DetailViewer hoverViewer = new DetailViewer();
    hoverViewer.setWidth(200); 
    hoverViewer.setDataSource(ds); 
    Criteria criteria = new Criteria(); 
    criteria.addCriteria("itemID", record.getAttribute("itemID"));
    hoverViewer.fetchData(criteria); 
    return hoverViewer;
}
        testCanvas.setShowHover(true);
        testCanvas.setCanHover(true);
        testCanvas.setShowHoverComponents(true);

When the method is overridden for a normal Canvas object (such as a DynamicForm, for example), the Hover item appears correctly (and bravo - it looks fantastic).
Overriding the Parent tileGrid does nothing, BUT - this suggests the way forward:
Quote:

Originally Posted by Isomorphic (Post 70929)
Use setTileProperties() to enable the normal Canvas-level properties and event handlers for hovers.

The code I've tried to use is as follows:

Code:

//TileGrid
    final static TileGrid tileGrid = new TileGrid();
//setTileProperties Canvas
    final static Canvas tileCanvas = new Canvas(){
    //Override the getHoverComponent for the setTilesProperties Canvas
    //This is identical to the previous test case
        @Override
        public Canvas getHoverComponent() {
            Record record = tileGrid.getSelectedRecord();
            DetailViewer hoverViewer = new DetailViewer();
            hoverViewer.setWidth(200); 
            hoverViewer.setDataSource(ds); 
            Criteria criteria = new Criteria(); 
            criteria.addCriteria("itemID", record.getAttribute("itemID")); 
            hoverViewer.fetchData(criteria); 
            return hoverViewer;
        }
    };
    final static DataSource ds = SwitchXmlDS.getInstance();
    private static void setupTileGrid() {
        tileCanvas.setShowHover(true);
        tileCanvas.setCanHover(true);
        tileCanvas.setShowHoverComponents(true);
        //set the TileProperty to use tileCanvas settings
        tileGrid.setTileProperties(tileCanvas);
        }

Unfortunately this doesn't trigger a DetailViewer hovercomponent. There's a dearth of use cases, and javadoc the isn't enlightening.

Thanks,

Terry

Viewing all articles
Browse latest Browse all 4756

Trending Articles