Announcement

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

    TileGrid Issues for arguments passing in tiles

    We are using TileGrid to show a datasource in tile form. We have created a custom class which is extending DynamicForm to create tile. In our Tile we have one StaticTextItem with some other fields. Our requirement is to provide click handler on this static text item from outside. Below is the code for CustomTileGrid :

    public class CustomTileGrid extends TileGrid{ public interface ProductSelectorMetaFactory extends BeanFactory.MetaFactory { BeanFactory<ProductSelectorTile> getProductSelectorTileFactory(); } public CustomTileGrid(DataSource cardViewDataSource, ProductSelectorTile tileType, String fieldState, List<DetailViewerField> list) { setDataSource(cardViewDataSource); setAutoFetchData(true); GWT.create(ProductSelectorMetaFactory.class); setTileConstructor(tileType.getClass().getName()); // I want to pass a clickhandler here to my tile class but do not have any option } } public class ProductSelectorTile extends DynamicForm { StaticTextItem pdfOpenImage = new StaticTextItem(); public ProductSelectorTile(ClickHandler clickHandler) { pdfOpenImage.addClickHandler(clickHandler); setFields(pdfOpenImage); } } Here ProductSelectorTile is our tile class which is extending DynamicForm which inside have one SelectTextItem. Till now what we found is that we can not pass any ClickHandler to Tile class constructor. It always look for default constructor and if ClickHandler passed via any setter method : it is not effective on that tile. Could you please help us to understand if there is any way using that we can pass our click handlers to Tile class. Any help is appreciated.
    Last edited by sidharth1917; 20 Sep 2017, 20:30. Reason: not properly formatted

    #2
    TileGrid automatically constructs tiles from data records, so there would be no way to pass a click handler to a custom TileGrid constructor.

    The API recordClick is there to handle clicks on the whole tile. Alternatively you could just install a ClickHandler on the custom tile class by default, and it can use the TileGrid to get context information (eg tileGrid.getTileRecord()).

    Comment


      #3
      Thanks Isomorphic. I was not sure about passing click handler to any particular static text item in tile(from outside) but it is not possible (confirmed with your reply).

      Comment

      Working...
      X