Announcement

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

    Bug with ListGrid detailFields in BuiltInDS sample

    Hi Isomorphic,

    please see this builtInDS-based testcase using 5.1d SNAPSHOT_v10.1d_2015-10-30, where "Manager" is hidden in the list of possible fields (you have to use the field picker in order to show it).
    BuiltInDS.java:
    Code:
    package com.smartgwt.sample.client;
    
    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.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.form.fields.SelectItem;
    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("Hidden ListGridField");
            w.setShowMinimizeButton(false);
            w.setIsModal(true);
            w.setShowModalMask(true);
            w.centerInPage();
            {
                final ListGrid testGrid = new ListGrid(DataSource.get("employees"));
                testGrid.setCanEdit(true);
                ListGridField idLGF = new ListGridField("EmployeeId");
    
                ListGridField nameLGF = new ListGridField("Name");
    
                ListGridField managerLGF = new ListGridField("ReportsTo");
                SelectItem managerEditItem = new SelectItem("ReportsTo");
                managerEditItem.setOptionDataSource(DataSource.get("employees"));
                managerEditItem.setValueField("EmployeeId");
                managerEditItem.setDisplayField("Name");
                managerLGF.setEditorProperties(managerEditItem);
    
                testGrid.setFields(idLGF, managerLGF, nameLGF);
                AdvancedCriteria ac = new AdvancedCriteria(new Criterion("Name", OperatorId.STARTS_WITH, "A"));
                testGrid.fetchData(ac);
                w.addItem(testGrid);
            }
            w.show();
        }
    }
    This behavior is not in sync with ListGrid.setShowDetailFields-docs that say that
    • showDetailFields - Default value is true
    • Fields may also be included directly in this component's fields array in which case they will be present regardless of the detail attribute.
    Either of the points should make the manager field (detail="true" in employees.ds.xml) to be initially displayed.

    Best regards
    Blama

    #2
    Hello Blama,

    Thanks for taking your time to tell us about this, however the documentation also states the following regarding showDetailFields.

    When this property is true, ListGrids will include all detail fields, but they will be initially hidden.
    It also says that in order to display the detail field you need to manually call the showField() api, set the showIf variable appropriately or simply let the user do it through the ListGrid header context menu.

    We realise there might be some room for improvement in the documentation here so we're looking at getting that resolved.

    Thanks,
    Isomorphic Software

    Comment


      #3
      Ok, thank you.

      Best regards
      Blama

      Comment

      Working...
      X