I am not able to dynamically set the image size of a tilegrid. When you click the button, nothing happens. I have tried with redraw() but same result.
Using smartgwt 6.0-p20160408 power
Code:
public void onModuleLoad() { VStack vStack = new VStack(20); vStack.setWidth100(); final TileGrid tileGrid = new TileGrid(); tileGrid.setTileWidth(158); tileGrid.setTileHeight(225); tileGrid.setHeight(400); tileGrid.setID("boundList"); tileGrid.setCanReorderTiles(true); tileGrid.setShowAllRecords(true); tileGrid.setDataSource(AnimalXmlDS.getInstance()); tileGrid.setAutoFetchData(false); tileGrid.setAnimateTileChange(true); DetailViewerField commonNameField = new DetailViewerField("commonName"); commonNameField.setCellStyle("commonName"); DetailViewerField lifeSpanField = new DetailViewerField("lifeSpan"); lifeSpanField.setCellStyle("lifeSpan"); lifeSpanField.setDetailFormatter(new DetailFormatter() { public String format(Object value, Record record, DetailViewerField field) { return "Lifespan: " + value; } }); final DetailViewerField pictureField = new DetailViewerField("picture"); pictureField.setType("image"); pictureField.setImageWidth(20); pictureField.setImageHeight(20); IButton click = new IButton("click me"); click.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { pictureField.setImageWidth(40); pictureField.setImageHeight(40); } }); DetailViewerField statusField = new DetailViewerField("status"); tileGrid.setFields(pictureField, commonNameField, lifeSpanField, statusField); vStack.addMember(tileGrid); AdvancedCriteria c = new AdvancedCriteria(OperatorId.OR, new Criterion[] { new Criterion("status", OperatorId.EQUALS, "Not Endangered"), new Criterion("status", OperatorId.EQUALS, "Protected"), new Criterion("status", OperatorId.EQUALS, "Threatened") }); DSRequest request = new DSRequest(); SortSpecifier[] sort = new SortSpecifier[1]; sort[0] = new SortSpecifier("commonName", SortDirection.ASCENDING); request.setSortBy(sort); tileGrid.fetchData(c, null, request); HLayout hLayout = new HLayout(10); hLayout.setHeight(22); vStack.addMember(hLayout); vStack.addMember(click); vStack.draw(); }
Comment