Announcement

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

    ListGridFieldType.IMAGE field does not display the icon in the filter row

    Hi Isomorphic,

    please see this v10.0p_2015-10-23 builtInDS based testcase:
    BuiltInDS.java:
    Code:
    package com.smartgwt.sample.client;
    
    import java.util.LinkedHashMap;
    
    import com.google.gwt.core.client.EntryPoint;
    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.Alignment;
    import com.smartgwt.client.types.ListGridFieldType;
    import com.smartgwt.client.types.OperatorId;
    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.grid.ListGrid;
    import com.smartgwt.client.widgets.grid.ListGridField;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public class BuiltInDS implements EntryPoint {
        private VLayout mainLayout;
        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();
                }
            });
    
            mainLayout = new VLayout(20);
            mainLayout.setWidth100();
            mainLayout.setHeight100();
    
            recreateBtn = new IButton("Recreate");
            recreateBtn.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    recreate();
                }
            });
            mainLayout.addMember(recreateBtn);
            recreate();
            mainLayout.draw();
        }
    
        private void recreate() {
            Window w = new Window();
            w.setWidth("95%");
            w.setHeight("95%");
            w.setMembersMargin(0);
            w.setModalMaskOpacity(70);
            w.setTitle("No icon in filter row SelectItem");
            w.setShowMinimizeButton(false);
            w.setIsModal(true);
            w.setShowModalMask(true);
            w.centerInPage();
            {
                final ListGrid testGrid = new ListGrid(DataSource.get("employees"));
                testGrid.setShowFilterEditor(true);
                testGrid.setCanEdit(true);
    
                ListGridField genderLGF = new ListGridField("Gender");
    
                ListGridField nameLGF = new ListGridField("Name");
    
                ListGridField jobLGF = new ListGridField("Job");
                ListGridField salaryLGF = new ListGridField("Salary");
                ListGridField orgUnitLGF = new ListGridField("OrgUnit");
                ListGridField maritalStatusLGF = new ListGridField("MaritalStatus");
                LinkedHashMap<String, String> vM = new LinkedHashMap<String, String>();
                vM.put("married", "[SKINIMG]actions/filter.png");
                vM.put("single", "[SKINIMG]actions/find.png");
                maritalStatusLGF.setValueMap(vM);
                maritalStatusLGF.setAlign(Alignment.CENTER);
                maritalStatusLGF.setType(ListGridFieldType.IMAGE);
    
                testGrid.setFields(genderLGF, nameLGF, jobLGF, salaryLGF, orgUnitLGF, maritalStatusLGF);
    
                testGrid.setSortField("Name");
                testGrid.fetchData(new AdvancedCriteria(new Criterion("Name", OperatorId.ISTARTS_WITH, "A")));
                w.addItem(testGrid);
            }
            w.show();
        }
    }
    Screenshot: Click image for larger version

Name:	NoFilterIcon.png
Views:	60
Size:	5.5 KB
ID:	232593


    As you can see, the filterrow displays the path-string instead of an icon.

    If this is not the correct way of dealing with this use-case, could you please describe the correct way? I do think though that this has worked before, but I'm not sure.

    Best regards
    Blama

    #2
    This kind of thing would usually be achieved by specifying valueIcons (but note that you'll also still need a valueMap to specify the actual options).

    Regards
    Isomorphic Software

    Comment


      #3
      Hi Isomorphic,

      thanks for the advice. For now, I solved it using a SelectItem-FilterEditor with a Yes/No valueMap. In my application there is a big red "X" for yes and nothing for no, so this is easy understood.
      I'll try the valueIcon system once I have more icons to display.

      Thank you & Best regards
      Blama

      Comment

      Working...
      X