Announcement

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

    Enhancment suggestion: API ListGridField.setHoverWidth(int width)

    Hi Isomorphic,

    I just noted that I can't define the Tooltip/Hover item width per ListGridField, as it extends DataClass and I can't find a way to get to my generated Canvas for the ListGridField, neither from ListGridField nor from ListGrid.
    I think it might be a good idea to add setHoverWidth (int width), as you already have setHoverCustomizer (HoverCustomizer hoverCustomizer)

    Best regards,
    Blama
    Last edited by Blama; 12 May 2015, 08:38.

    #2
    Hi Isomorphic,

    I'm using current 5.0p (v10.0p_2015-05-06), which has ListGridField.setHoverWidth() (see also this thread).

    But for me this seems not to work, see this BuiltInDS-based showcase:
    Code:
    package com.smartgwt.sample.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.core.KeyIdentifier;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.data.SortSpecifier;
    import com.smartgwt.client.types.SortDirection;
    import com.smartgwt.client.util.PageKeyHandler;
    import com.smartgwt.client.util.Page;
    import com.smartgwt.client.util.SC;
    import com.smartgwt.client.widgets.IButton;
    import com.smartgwt.client.widgets.events.ClickEvent;
    import com.smartgwt.client.widgets.events.ClickHandler;
    import com.smartgwt.client.widgets.grid.HoverCustomizer;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.grid.ListGridField;
    import com.smartgwt.client.widgets.grid.ListGridRecord;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public class BuiltInDS implements EntryPoint {
    	private VLayout vL;
    	private TestGrid tG;
    
    	public void onModuleLoad() {
    		KeyIdentifier debugKey = new KeyIdentifier();
    		debugKey.setCtrlKey(true);
    		debugKey.setKeyName("D");
    
    		Page.registerKey(debugKey, new PageKeyHandler() {
    			public void execute(String keyName) {
    				SC.showConsole();
    			}
    		});
    
    		vL = new VLayout(5);
    		vL.setPadding(20);
    		vL.setWidth100();
    		vL.setHeight100();
    		tG = new TestGrid();
    
    		IButton reload = new IButton("Reload");
    		reload.addClickHandler(new ClickHandler() {
    			@Override
    			public void onClick(ClickEvent event) {
    				vL.removeChild(tG);
    				tG.markForRedraw();
    				tG = new TestGrid();
    				vL.addMember(tG, 0);
    			}
    		});
    		vL.addMembers(tG, reload);
    		vL.draw();
    	}
    
    	private class TestGrid extends ListGrid {
    		public TestGrid() {
    			super(DataSource.get("animals"));
    
    			ListGridField commonName = new ListGridField("commonName");
    			commonName.setHoverCustomizer(new HoverCustomizer() {
    				@Override
    				public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
    					String descStr = record.getAttribute("information");
    					if (descStr == null)
    						descStr = "[no information]";
    					return descStr;
    				}
    			});
    			commonName.setHoverDelay(100);
    			commonName.setShowHover(true);
    			commonName.setHoverWidth(800);
    
    			ListGridField scientificName = new ListGridField("scientificName");
    			scientificName.setHoverCustomizer(new HoverCustomizer() {
    				@Override
    				public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
    					String descStr = record.getAttribute("information");
    					if (descStr == null)
    						descStr = "[no information]";
    					return descStr;
    				}
    			});
    			scientificName.setHoverDelay(100);
    			scientificName.setShowHover(true);
    
    			ListGridField lifeSpan = new ListGridField("lifeSpan");
    			ListGridField status = new ListGridField("status");
    			ListGridField diet = new ListGridField("diet");
    			ListGridField information = new ListGridField("information");
    
    			setAutoFetchData(false);
    			setCanHover(true);
    			// setHoverWidth(1600);
    			setFields(commonName, scientificName, lifeSpan, status, diet, information);
    			setSort(new SortSpecifier[] { new SortSpecifier(lifeSpan.getName(), SortDirection.ASCENDING),
    					new SortSpecifier(diet.getName(), SortDirection.DESCENDING) });
    			fetchData();
    		}
    	}
    
    }
    See hoverWidth for field commonName. Also, if you set a different hoverWidth on the ListGrid-level, the ListGridField-hoverWidth is unused/overwritten.

    Best regards
    Blama

    Comment


      #3
      This has been fixed for builds dated May 14 and later.

      Comment

      Working...
      X