How can I detect when a user clicks on a facet in the CubeGrid with SmartGWTEE?
With Smartclient 8, there is facetValueSelectionChanged, which works well for me. But when using the nightly build from June 15 of SmartGWTEE 2.5, there is no corresponding method.
Smartclient version:
SmartGWTEE 2.5 version:
With Smartclient 8, there is facetValueSelectionChanged, which works well for me. But when using the nightly build from June 15 of SmartGWTEE 2.5, there is no corresponding method.
Smartclient version:
Code:
myCube = isc.CubeGrid.create({ data:incomingData, width:700, height:700, hideEmptyFacetValues:false, wrapFacetTitle:true, canReorderColumns:false, defaultFacetWidth:60, formatCellValue:"isc.Format.toUSString(value)", canSelectHeaders:true, facetValueSelectionChanged:facetClicked, columnFacets:["day","name"], rowFacets:["stat"], position:"relative" }); function facetClicked(clickedFacet) { console.log(clickedFacet); }
Code:
final VLayout everything = new VLayout(); dataSource.fetchData(c, new DSCallback() { @Override public void execute(DSResponse response, Object rawData, DSRequest request) { final CubeGrid cubeGrid2 = new CubeGrid(); cubeGrid2.setData(response.getData()); cubeGrid2.setWidth100(); cubeGrid2.setHeight100(); cubeGrid2.setHideEmptyFacetValues(true); cubeGrid2.setShowCellContextMenus(true); cubeGrid2.setColumnFacets("day","name"); cubeGrid2.setRowFacets("stat"); final NumberFormat numberFormat = NumberFormat.getFormat("###,###,###,###"); cubeGrid2.setCellFormatter(new CellFormatter() { public String format(Object value, ListGridRecord record, int rowNum, int colNum) { if (value == null) return null; try { return numberFormat.format(((Number) value).longValue()); } catch (Exception e) { return value.toString(); } } }); //this only works if you click a cell inside the grid, not on the facet title. cubeGrid2.addCellClickHandler(new CellClickHandler() { @Override public void onCellClick(CellClickEvent event) { SC.say("first handler"); } }); //this never seems to fire cubeGrid2.addSelectionChangedHandler(new SelectionChangedHandler() { @Override public void onSelectionChanged(SelectionEvent event) { SC.say("second handler"); } }); everything.addMember(cubeGrid2); } });
Comment