Hi Isomorphic,
I have a strange error I can't reproduce (using current 5.1/Simplicity or 6.1/Tahoe based skins, tested with v10.1p_2017-10-05 and v11.1p_2017-10-05). I have longstanding problems with icons as ListGridField values and filters (I'll create a testcase for this as well). Now I tried using valueIcons instead.
Here I have a strange issue that the framework generates two images for the value (as background and - failing - as img-tag)
Unfortunately I'm not able reproduce the issue, but I have a testcase that very closely matches my application setup. Perhaps you already have a idea how this could happen?
This is the erroneous markup I get:
Of course, the URL of the IMG-tag does not work, It's only that "Y" is the value (field of type="text" length="1", no escapeHTML).
This is my testcase screenshot, which does not show the issue (correct - only one IMG-tag):
BuiltInDS.java:
Does this give you an idea of what might be happening?
Perhaps I'm missing some code to trigger the issue in the tetscase. What does control if the valueIcon image is created as CSS background-image or as IMG-tag?
Best regards
Blama
I have a strange error I can't reproduce (using current 5.1/Simplicity or 6.1/Tahoe based skins, tested with v10.1p_2017-10-05 and v11.1p_2017-10-05). I have longstanding problems with icons as ListGridField values and filters (I'll create a testcase for this as well). Now I tried using valueIcons instead.
Here I have a strange issue that the framework generates two images for the value (as background and - failing - as img-tag)
Unfortunately I'm not able reproduce the issue, but I have a testcase that very closely matches my application setup. Perhaps you already have a idea how this could happen?
This is the erroneous markup I get:
Of course, the URL of the IMG-tag does not work, It's only that "Y" is the value (field of type="text" length="1", no escapeHTML).
This is my testcase screenshot, which does not show the issue (correct - only one IMG-tag):
BuiltInDS.java:
Code:
package com.smartgwt.sample.client; import java.util.LinkedHashMap; import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.Version; import com.smartgwt.client.core.KeyIdentifier; import com.smartgwt.client.data.AdvancedCriteria; import com.smartgwt.client.data.Criterion; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.types.GroupStartOpen; import com.smartgwt.client.types.ListGridFieldType; import com.smartgwt.client.types.OperatorId; import com.smartgwt.client.types.RecordComponentPoolingMode; import com.smartgwt.client.util.Page; import com.smartgwt.client.util.PageKeyHandler; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.IButton; import com.smartgwt.client.widgets.Window; import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.events.ClickHandler; import com.smartgwt.client.widgets.form.fields.SelectItem; 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 extends VLayout implements EntryPoint { private IButton recreateBtn; 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(); } }); // DefaultApperanceSetter.setDefaultApperance(); setWidth100(); setHeight100(); recreateBtn = new IButton("Recreate"); recreateBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { new MyWindow().show(); } }); addMember(recreateBtn); new MyWindow().show(); draw(); } private class MyWindow extends Window { public MyWindow() { setWidth("95%"); setHeight("95%"); setMembersMargin(0); setModalMaskOpacity(70); setTitle(" (" + Version.getVersion() + "/" + Version.getSCVersionNumber() + ")"); setTitle("ValueIcon problem with two images (img-tag and CSS background-image)" + getTitle()); setShowMinimizeButton(false); setIsModal(true); setShowModalMask(true); centerInPage(); ListGrid valueIconTest = new ValueIconTest(); addItem(valueIconTest); ListGrid valueIconTest2 = new ValueIconTest(); addItem(valueIconTest2); } } private class ValueIconTest extends ListGrid { public ValueIconTest() { super(DataSource.get("animals")); setWidth(1000); setHeight(500); setShowFilterEditor(true); setAutoFetchData(false); setShowRecordComponents(true); setShowRecordComponentsByCell(true); setRecordComponentPoolingMode(RecordComponentPoolingMode.RECYCLE); setPoolComponentsPerColumn(true); setRecordComponentHeight(22); setCanGroupBy(false); setCanReorderFields(true); setGroupStartOpen(GroupStartOpen.ALL); setSortByGroupFirst(true); setAllowFilterExpressions(true); setGroupByField("lifeSpan"); ListGridField lifeSpanLGF = new ListGridField("lifeSpan"); ListGridField commonNameLGF = new ListGridField("commonName"); ListGridField statusLGF = new StatusListGridField("status"); ListGridField status2LGF = new StatusListGridField("status2"); setFields(commonNameLGF, lifeSpanLGF, statusLGF, status2LGF); setSortField("commonName"); fetchData(new AdvancedCriteria(new Criterion("commonName", OperatorId.LESS_OR_EQUAL, "F"))); } @Override protected String getCellCSSText(ListGridRecord record, int rowNum, int colNum) { String cssText = "color:#888;"; return cssText; } } private class StatusListGridField extends ListGridField { public StatusListGridField(String name) { super(name); setType(ListGridFieldType.IMAGE); setValueIconSize(16); setValueMap(getIconValueMap()); setHoverCustomizer(new HoverCustomizer() { @Override public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) { if (record == null) return null; else switch (record.getAttribute("status")) { case "Threatened": return "TEST2-Threatened"; case "Endangered": return "TEST2-Endangered"; case "Not Endangered": return "TEST2-Not Endangered"; case "Not currently listed": return "TEST2-Not currently listed"; case "May become threatened": return "TEST2-May become threatened"; case "Protected": return "TEST2-Protected"; default: return null; } } }); setShowHover(true); setHoverWidth(100); setWidth(150); setCanDragResize(false); setCanFilter(true); setFilterEditorProperties(new SelectItemStatus()); } private LinkedHashMap<String, String> getIconValueMap() { LinkedHashMap<String, String> vM = new LinkedHashMap<String, String>(); vM.put("Threatened", "[SKINIMG]actions/approve.png"); vM.put("Endangered", "[SKINIMG]actions/exclamation.png"); vM.put("Not Endangered", "[SKINIMG]actions/help.png"); vM.put("Not currently listed", "[SKINIMG]actions/prev.png"); vM.put("May become threatened", "[SKINIMG]actions/cancel.png"); vM.put("Protected", ""); return vM; } } private class SelectItemStatus extends SelectItem { public SelectItemStatus() { super(); setValueMap(getDisplayMap()); setAllowEmptyValue(true); setMultiple(true); } private LinkedHashMap<String, String> getDisplayMap() { LinkedHashMap<String, String> vM = new LinkedHashMap<String, String>(); vM.put("Threatened", "TEST-Threatened"); vM.put("Endangered", "TEST-Endangered"); vM.put("Not Endangered", "TEST-Not Endangered"); vM.put("Not currently listed", "TEST-Not currently listed"); vM.put("May become threatened", "TEST-May become threatened"); vM.put("Protected", "TEST-Protected"); return vM; } } }
Perhaps I'm missing some code to trigger the issue in the tetscase. What does control if the valueIcon image is created as CSS background-image or as IMG-tag?
Best regards
Blama
Comment