Announcement

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

    ListGrid: valueIcons for empty cells

    Hello Isomorphic,

    I have a question regarding Value icons in listgrid field.
    When a field 'bool 'of type BOOLEAN has value icons defined as such:
    Code:
    valueIcons.put("true", "IconBooleanTrue");
    valueIcons.put("false", "IconBooleanFalse");
    valueIcons.put("null", "IconBooleanNull");
    and the grid has records with the field 'bool' being populated with "true"/"false" or left empty, the value icons do not show for the empty cells.
    Now I do realise, that there is no actual "null" within these cells, so it would make sense that no value icon is displayed for empty cells but when I try to retrieve the corresponding valueIcon from a record's field via ListGrid.getValueIcon(ListGridField, Object, ListGridRecord) it does recognise that for an empty cell, the value icon should be "KiIconBooleanNull" (but doesn't display it).

    I suppose this could be achieved by overriding ListGrid.getValueIcon() as specified in the docs but I just find it curious, that the value icon is determined to a valid value but not displayed.

    SmartGWT: v12.0p_2018-08-25/Pro Deployment (built 2018-08-25)
    Chrome 68.0.3440.106
    Test case for completeness sake:
    Code:
     @Override
    public void onModuleLoad() {
            ListGrid grid = new ListGrid();
            grid.setWidth(800);
            grid.setHeight(600);
            grid.addRecordClickHandler(new RecordClickHandler() {
                @Override
                public void onRecordClick(RecordClickEvent event) {
                    String fieldN = event.getField().getName();
                    GWT.log("record value: " + event.getRecord().getAttribute(fieldN));
                    GWT.log(grid.getValueIcon(event.getField(), event.getRecord().getAttribute(fieldN), event.getRecord()));              }
            });
    
            ListGridField lgf = new ListGridField("bool", 150);
            lgf.setType(ListGridFieldType.BOOLEAN);
            Map<String, String> valueIcons = new HashMap<String, String>();
            valueIcons.put("true", "IconBooleanTrue");
            valueIcons.put("false", "IconBooleanFalse");
            valueIcons.put("null", "IconBooleanNull");
            lgf.setValueIcons(valueIcons);
            lgf.setImageURLSuffix(".svg");
    
            ListGridField lgfID = new ListGridField("id", 50);
            lgfID.setType(ListGridFieldType.INTEGER);
    
            grid.setFields(lgfID, lgf);
    
            ListGridRecord r1 = new ListGridRecord();
            r1.setAttribute("bool", true);
            r1.setAttribute("id", 1);
            ListGridRecord r2 = new ListGridRecord();
            r2.setAttribute("bool", false);
            r2.setAttribute("id", 2);
            ListGridRecord r3 = new ListGridRecord();
            r3.setAttribute("id", 3);
            grid.setData(r1, r2, r3);
            grid.draw();
    }
    Last edited by pavel.benes; 19 Sep 2018, 00:41.

    #2
    Put an actual null into the record rather than leaving the value undefined.

    Comment

    Working...
    X