Announcement

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

    Bug in Listgrid with filter and row numbers and hilites

    I have a listgrid with filter on keypress and also row numbers and hilites enabled (see sample below).
    While editing the filter in firefox, the focus moves out of the filter field when entering any letter. For entering a 2nd one, one has to reset the focus into the filter field.
    This happens in FF, but works with Chrome and IE.
    This only happens when both row numbers and hilites are set. If either one of those is not set, it also works in FF.

    Is there anything wrong with the code or can this bug be fixed?


    SmartGWT LGPL 3.1p/LGPL/2013-04-17
    SmartGWT LGPL 3.1p/LGPL/2013-03-03

    FF (Firefox) 16, 19, 20: Do not work
    Chrome 27: works
    IE (Internet Explorer) 8.0: works
    Code:
    package com.test;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.data.Criterion;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.data.DataSourceField;
    import com.smartgwt.client.data.Hilite;
    import com.smartgwt.client.types.AutoFitWidthApproach;
    import com.smartgwt.client.types.FieldType;
    import com.smartgwt.client.types.OperatorId;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.grid.ListGridField;
    import com.smartgwt.client.widgets.grid.ListGridRecord;
    
    
    public class Test implements EntryPoint {
    
        @Override
        public void onModuleLoad() {
            ListGrid grid = new ListGrid();
    
            grid.setShowRowNumbers(true);
            grid.setShowFilterEditor(true);
            grid.setFilterOnKeypress(true);
    
            grid.setDataSource(ClientDataSource.getInstance());
            grid.setAutoFetchData(true);
    
            ListGridField nameField = new ListGridField(ClientDataSource.NAME, "Name");
            nameField.setAutoFitWidthApproach(AutoFitWidthApproach.TITLE);
    
            grid.setFields(nameField);
            grid.setHilites(new Hilite[] { new Hilite() {
                {
                    setCssText("font-weight:bold;");
                    setFieldNames(ClientDataSource.NAME);
                    setCriteria(new Criterion(ClientDataSource.NAME, OperatorId.CONTAINS, "Second"));
                }
            } });
    
            grid.draw();
        }
    
        public static class ClientDataSource extends DataSource {
    
            public static final String ID = "id";
            public static final String NAME = "name";
    
            private static ClientDataSource instance = null;
    
            public static ClientDataSource getInstance() {
                if (null == instance) {
                    instance = new ClientDataSource();
                }
                return instance;
            }
    
            private ClientDataSource() {
                DataSourceField idField = new DataSourceField(ID, FieldType.INTEGER);
                idField.setPrimaryKey(true);
                idField.setHidden(true);
    
                DataSourceField nameField = new DataSourceField(NAME, FieldType.TEXT, "Name");
    
                setFields(idField, nameField);
                setClientOnly(true);
                setCacheData(ClientData.getRecords());
            }
    
            private static class ClientData {
    
                private static ClientRecord[] records;
    
                public static ClientRecord[] getRecords() {
                    if (records == null) {
                        records = getNewRecords();
                    }
                    return records;
                }
    
                public static ClientRecord[] getNewRecords() {
                    return new ClientRecord[] { new ClientRecord("First, Name"), new ClientRecord("Second, One"), new ClientRecord("Third, Thing") };
                }
            }
    
            private static class ClientRecord extends ListGridRecord {
    
                private static int id = 1;
    
                public ClientRecord(String name) {
                    setAttribute(ClientDataSource.ID, id++);
                    setAttribute(ClientDataSource.NAME, name);
                }
            }
        }
    
    }

    #2
    We've made a change to address this issue in the 8.3 and 9.0d branches
    Please let us know if you continue to see it on nightly builds dated April 19 or greater

    Thanks
    Isomorphic Software

    Comment


      #3
      Fixed, works.

      Comment

      Working...
      X