Announcement

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

    6.1d Strange ListGrid height effect. Some testing residues in the framework code?

    Hi Isomorphic,

    for one of my ListGrids that does not differ in any meaningful way from my other similar grids, I get the following effect when calling setShowFilterEditor(true):
    The filterRow is shown, but the ListGrid resizes and I get this in the log:
    Code:
    00:42:29.688:MUP9:WARN:listPolicy:stretchResize for ListGrid_inCreation with totalSize: 671 and calculated sizes: 36,40,65; cannot assign remainingSpace: 530 due to member max size limits
    00:42:29.690:MUP9:WARN:listPolicy:stretchResize for ListGrid_inCreation with totalSize: 671 and calculated sizes: 36,40,65; cannot assign remainingSpace: 530 due to member max size limits
    00:42:30.134:MUP9:WARN:listPolicy:stretchResize for ListGrid_inCreation with totalSize: 671 and calculated sizes: 36,40,65; cannot assign remainingSpace: 530 due to member max size limits
    00:42:30.135:MUP9:WARN:listPolicy:stretchResize for ListGrid_inCreation with totalSize: 671 and calculated sizes: 36,40,65; cannot assign remainingSpace: 530 due to member max size limits
    "36","40" and "65" match the heights for filterRow, HeaderButtons and GridBody. The GridBody is obviously not high enough, but I don't have any "65" in my code. Do you have an idea what might be causing this?
    I did not find "65" in skin_styles.js or in modules-debug files.

    On hiding the filterRow, the ListGrid has it original height.

    I'm using SNAPSHOT_v11.1d_2017-03-27.

    Best regards
    Blama

    #2
    I also have another ListGrid, where it is the other way around:
    Height OK with filterRow, not OK without. The message in the log then is:
    Code:
    01:13:08.033:MUP5:WARN:listPolicy:stretchResize for ListGrid_closed with totalSize: 670 and calculated sizes: 40,65; cannot assign remainingSpace: 565 due to member max size limits
    01:13:08.033:MUP5:WARN:listPolicy:stretchResize for ListGrid_closed with totalSize: 670 and calculated sizes: 40,65; cannot assign remainingSpace: 565 due to member max size limits
    where 40 is again the headerHeight and 65 the GridBody height.

    Best regards
    Blama

    Comment


      #3
      We're not able to reproduce this. Can you provide sample code?

      Comment


        #4
        Hi Isomorphic,

        I found out where the "65" comes from, but it does not any get more understandable.
        The value is the width of my first recordComponent-column. Not the width of the recordComponent itself, but of the belonging ListGridField.
        If I change the value from 65 to 75, the height of the ListGridBody gets 75, if I change it to 85, the ListGridBody height gets 85.

        The reason why this happend only in some ListGrids is that in the ListGrids where it happens, the recordComponent-column is not the 1st column.
        When the recordComponent-column is the 1st column, the issue does not arise - so perhaps an off-by-one here.

        Was this area (ListGridField-width plus perhaps recordComponents) changed for 6.1?
        Does this already help you to find the bug?

        Thank you & Best regards
        Blama

        Comment


          #5
          Sorry, we don't see an obvious reason for this, we suspect it may be a problem in your code. We need a test case to look further.

          Comment


            #6
            Hi Isomorphic,

            pretty happy I was able to create a testcase for such a weird one. It's many classes, but closely mimics my Application's main VLayout design. Still one file only, though.

            See that the ListGrids in the 2nd and 3rd SectionsStackSections strangely resize if you click "Filter LG" when the respective SectionsStackSection is open.
            See that the ListGrids in the 4th SectionsStackSection is strangely resized already and sizes normal if you click "Filter LG"

            Important factor are the field order which determines if the bug arises and the width of the 1st ListGridField with a recordComponent. The width determines the height of the to-small ListGrid.

            Tested with SNAPSHOT_v11.1d_2017-04-03. I don't know if this underlying issue is also present in other versions, I did not notice it in 5.1p and did not test 6.0p.

            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.data.SortSpecifier;
            import com.smartgwt.client.types.Alignment;
            import com.smartgwt.client.types.GroupStartOpen;
            import com.smartgwt.client.types.OperatorId;
            import com.smartgwt.client.types.RecordComponentPoolingMode;
            import com.smartgwt.client.types.SortDirection;
            import com.smartgwt.client.util.Page;
            import com.smartgwt.client.util.PageKeyHandler;
            import com.smartgwt.client.util.SC;
            import com.smartgwt.client.widgets.Canvas;
            import com.smartgwt.client.widgets.IButton;
            import com.smartgwt.client.widgets.events.ClickEvent;
            import com.smartgwt.client.widgets.events.ClickHandler;
            import com.smartgwt.client.widgets.form.fields.ComboBoxItem;
            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.HLayout;
            import com.smartgwt.client.widgets.layout.SectionStack;
            import com.smartgwt.client.widgets.layout.SectionStackSection;
            import com.smartgwt.client.widgets.layout.VLayout;
            
            public class BuiltInDS implements EntryPoint {
                private VLayout mainLayout;
            
                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();
            
                    HLayout buttonsLayout = new HLayout();
                    IButton recreateBtn = new IButton("Recreate");
                    recreateBtn.addClickHandler(new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent event) {
                            recreate();
                        }
                    });
                    buttonsLayout.addMember(recreateBtn);
            
                    IButton switchFilterBtn = new IButton("Filter LG");
                    switchFilterBtn.addClickHandler(new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent event) {
                            if (mainLayout.getMembersLength() > 1) {
                                SectionStack ss = (SectionStack) mainLayout.getMember(1);
            
                                for (SectionStackSection sss : ss.getSections()) {
                                    if (ss.sectionIsExpanded(ss.getSectionNumber(sss.getName()))) {
                                        ListGrid lg = (ListGrid) sss.getItems()[0];
                                        lg.setShowFilterEditor(!lg.getShowFilterEditor());
                                    }
                                }
                            }
                        }
                    });
                    buttonsLayout.addMember(switchFilterBtn);
            
                    mainLayout.addMember(buttonsLayout);
                    recreate();
                    mainLayout.draw();
                }
            
                private void recreate() {
                    if (mainLayout.getMembersLength() > 1) {
                        mainLayout.removeMember(mainLayout.getMember(1));
                    }
                    mainLayout.addMember(getComponent(), 1);
                }
            
                private SectionStack getComponent() {
                    SectionStack ss = new SectionStack();
            
                    SectionStackSection sss1 = new SectionStackSection("SSS1");
                    sss1.addItem(new MyListGrid(1));
            
                    SectionStackSection sss2 = new SectionStackSection("SSS2");
                    sss2.addItem(new MyListGrid(3));
            
                    SectionStackSection sss3 = new SectionStackSection("SSS3");
                    sss3.addItem(new MyListGrid(3));
            
                    SectionStackSection sss4 = new SectionStackSection("SSS4");
                    sss4.addItem(new MyListGrid(2));
            
                    ss.setSections(sss1, sss2, sss3, sss4);
                    return ss;
                }
            
                private class MyListGrid extends ListGrid {
                    public MyListGrid(int posFirstRC) {
                        super(DataSource.get("employees"));
                        setHeight100();
                        setAutoFetchData(false);
                        setShowRecordComponents(true);
                        setShowRecordComponentsByCell(true);
                        setRecordComponentPoolingMode(RecordComponentPoolingMode.RECYCLE);
                        setPoolComponentsPerColumn(true);
                        setRecordComponentHeight(22);
                        setCanGroupBy(false);
                        setCanReorderFields(true);
                        setGroupStartOpen(GroupStartOpen.ALL);
                        setSortByGroupFirst(true);
                        setAllowFilterExpressions(true);
                        setWrapHeaderTitles(true);
                        setLeaveHeaderMenuButtonSpace(false);
                        setGroupSortDirection(SortDirection.ASCENDING);
                        setGroupByField("Gender");
            
                        ListGridField employeeId = new ListGridField("EmployeeId");
                        ListGridField name = new ListGridField("Name");
                        ListGridField gender = new ListGridField("Gender");
                        ListGridField reportsTo = new ListGridFieldReportsTo("ReportsTo");
                        ListGridField job = new ListGridField("Job");
            
                        // TODO: Change the last parameter here to see the broken LGs grow
                        ListGridFieldButton button1LGF = new ListGridFieldButton("button1", "Button 1", 120);
                        ListGridFieldButton button2LGF = new ListGridFieldButton("button2", "Button 2", 130);
                        ListGridFieldButton button3LGF = new ListGridFieldButton("button3", "Button 3", 130);
            
                        // TODO: The field order here is important
                        if (posFirstRC == 1)
                            setFields(button1LGF, employeeId, name, gender, reportsTo, job, button2LGF, button3LGF);
                        else if (posFirstRC == 2)
                            setFields(employeeId, button1LGF, name, gender, reportsTo, job, button2LGF, button3LGF);
                        else if (posFirstRC == 3)
                            setFields(employeeId, name, button1LGF, gender, reportsTo, job, button2LGF, button3LGF);
            
                        setSort(new SortSpecifier[] { new SortSpecifier(name.getName(), SortDirection.ASCENDING) });
                        fetchData(new AdvancedCriteria(new Criterion(name.getName(), OperatorId.LESS_OR_EQUAL, "C")));
                    }
            
                    @Override
                    protected Canvas createRecordComponent(final ListGridRecord record, Integer colNum) {
                        return updateRecordComponent(record, colNum, null, true);
                    }
            
                    @Override
                    public Canvas updateRecordComponent(ListGridRecord record, Integer colNum, Canvas component, boolean recordChanged) {
                        if (record.getIsGroupSummary())
                            return null;
            
                        String fieldName = this.getFieldName(colNum);
                        if ("button1".equals(fieldName)) {
                            if (component != null) {
                                Button1 b1 = (Button1) component;
                                return b1;
                            } else {
                                return new Button1(record);
                            }
                        } else if ("button2".equals(fieldName)) {
                            if (component != null) {
                                Button2 b2;
                                b2 = (Button2) component;
                                b2.setData(record);
                                return b2;
                            } else {
                                return new Button2(record);
                            }
                        } else if ("button3".equals(fieldName)) {
                            if (component != null) {
                                Button3 b3 = (Button3) component;
                                b3.setData(record);
                                return b3;
                            } else {
                                return new Button3(record);
                            }
                        } else {
                            return null;
                        }
                    };
                }
            
                private class ListGridFieldReportsTo extends ListGridField {
                    public ListGridFieldReportsTo(String name) {
                        super(name);
                        ComboBoxItem managerCBI = new ComboBoxItem();
                        managerCBI.setOptionDataSource(DataSource.get("employees"));
                        managerCBI.setOptionOperationId("foobar");
                        managerCBI.setValueField(DataSource.get("employees").getPrimaryKeyFieldName());
                        managerCBI.setDisplayField("Name");
                        managerCBI.setPickListSort(new SortSpecifier[] { new SortSpecifier("EmployeeId", SortDirection.ASCENDING),
                                new SortSpecifier("Name", SortDirection.ASCENDING) });
                        ListGridField managerCBI_empIdLGF = new ListGridField("EmployeeId");
                        ListGridField managerCBI_nameLGF = new ListGridField("Name");
                        managerCBI.setPickListFields(managerCBI_empIdLGF, managerCBI_nameLGF);
                        managerCBI.setPickListHeaderHeight(0);
                        setEditorProperties(managerCBI);
                    }
                }
            
                private class ListGridFieldButton extends ListGridField {
                    public ListGridFieldButton(String name, String title, int width) {
                        super(name, title);
                        configure(width);
                    }
            
                    private void configure(Integer width) {
                        setCanFilter(false);
                        setCanEdit(false);
                        setCanGroupBy(false);
                        setCanSort(false);
                        setCanDragResize(false);
                        setCanAutoFitWidth(false);
                        setShowGridSummary(false);
                        setShowGroupSummary(false);
                        setCanExport(false);
            
                        if (width != null) {
                            setWidth(width);
                            setDefaultWidth(width);
                            setMinWidth(width);
                            setMaxWidth(width);
                        } else {
                            // Default width of ActionIButton is 115
                            setWidth(115);
                            setDefaultWidth(115);
                            setMinWidth(115);
                            setMaxWidth(115);
                        }
                    }
                }
            
                private class ActionIButton extends IButton {
                    protected ListGridRecord record;
            
                    public ActionIButton(final ListGridRecord record) {
                        super();
                        setData(record);
                        setHeight(22);
                        setWidth(115);
                        setIconSize(18);
                        setAlign(Alignment.LEFT);
                    }
            
                    public ListGridRecord getRecord() {
                        return record;
                    }
            
                    public void setData(ListGridRecord record) {
                        this.record = record;
                    }
                }
            
                public class Button1 extends ActionIButton {
                    public Button1(ListGridRecord record) {
                        super(record);
                        setWidth(90);
                        setTitle("B1");
                        setIcon("[SKINIMG]none.png");
                    }
                }
            
                public class Button2 extends ActionIButton {
                    public Button2(ListGridRecord record) {
                        super(record);
                        setWidth(120);
                        setTitle("B2");
                        setIcon("[SKINIMG]none.png");
                    }
                }
            
                public class Button3 extends ActionIButton {
                    public Button3(ListGridRecord record) {
                        super(record);
                        setWidth(120);
                        setTitle("B3");
                        setIcon("[SKINIMG]none.png");
                    }
                }
            }
            This is an important one for me.

            Best regards
            Blama
            Last edited by Blama; 4 Apr 2017, 11:56.

            Comment


              #7
              By way of an update - note that we *do* see this issue - it isn't fixed yet, but we know what we're looking for and will update here once its fixed.

              In the meantime, the issue is a direct result of your calls to ListGridField.setMaxWidth() - so if you just remove those, it will all work as expected.

              Note also that it's nothing to do with recordComponents - you can switch off showRecordComponents altogether and still see the issue - it's purely those calls to setMaxWidth().

              Comment


                #8
                Hi Isomorphic,

                ah, thank you. I mixed two things together then. You added ListGridField.setMaxWidth() here to 6.0, but I did not use it so far (did not switch to 6.0).
                When testing 6.1d, I added also the call to it (only for my Button-recordComponent fields), but did not directly notice the issue.
                When I did I assumed that it was related to recordComponent, because it happend there for me.

                For me, the workaround of temporarily commenting out setMaxWidth() is fine, thank you.
                Please note that the issue then might also be in 6.0p.

                Best regards
                Blama

                Comment


                  #9
                  This has now been fixed - it may have hit today's builds but, if not, will certainly be in those dated April 8 and later.

                  Comment


                    #10
                    Hi Isomorphic,

                    this is fixed for me using SNAPSHOT_v11.1d_2017-04-09.

                    Thank you & Best regards
                    Blama

                    Comment

                    Working...
                    X