Announcement

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

    Bad resize behavior when filling a Listgrid grouped by a field

    Firefox 24,
    <gwtVersion>2.6.1</gwtVersion>
    <smartgwtVersion>5.0-p20141210</smartgwtVersion>

    Hi,

    I have a ListGrid component that is contained in a SectionStackSection, and I grouped it by a field that is contained in a hidden field.
    I also use the group summary to show some data in the header of each group element.

    Code:
    ListGrid grid = new ListGrid() {
    @Override
    protected Canvas createRecordComponent(final ListGridRecord record, final Integer colNr) {
    final String fieldName = this.getFieldName(colNr);
    
    if (FILE.equals(fieldName)) {
    final Button btnDetails = new Button(messages.details());
    btnDetails.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(final ClickEvent clickEvent) {
    triggerDownload(record);
    }
    });
    
    return btnDetails;
    }
    else {
    return null;
    }
    }
    };
    
    ListGridField parentField = new ListGridField("parent", messages.mcmCommand());
    parentField.setHidden(true);
    parentField.setShowGroupSummary(false);
    
    ListGridField commandGridField = new ListGridField("commandName", messages.command());
    commandGridField.setShowGroupSummary(true);
    commandGridField.setWidth("*");
    
    ListGridField statusGridField = new ListGridField("status", messages.status());
    statusGridField.setShowGroupSummary(true);
    statusGridField.setAutoFitWidth(true);
    statusGridField.setAutoFitWidthApproach(AutoFitWidthApproach.BOTH);
    
    ListGridField fileGridField = new ListGridField(FILE, messages.file());
    fileGridField.setShowGroupSummary(false);
    fileGridField.setWidth(new Button(messages.file()).getWidth() + 10);
    
    grid.setFields(parentField, commandGridField, statusGridField, fileGridField);
    grid.groupBy("parent");
    grid.setShowGroupSummary(true);
    grid.setShowGroupSummaryInHeader(true);
    grid.setShowRecordComponents(true);
    grid.setShowRecordComponentsByCell(true);
    grid.setGroupStartOpen(GroupStartOpen.NONE);
    return grid;
    My problem is that when there are data in my grid, the first column containing the group elements is badly resized and its content does not entirely appear (Te... au lieu de Test1).
    Moreover, the grid does not fill the entire space that is allocated to it. I mean that I can resize columns to get my expected interface, but it's not directly as I want it to be.

    Current display :
    &#194;&#160; Click image for larger version

Name:	listgrid_bad.png
Views:	70
Size:	10.9 KB
ID:	231196





    Expected Display :
    &#194;&#160; Click image for larger version

Name:	listgrid.PNG
Views:	55
Size:	18.8 KB
ID:	231197






    I already found some elements that answer a little bit my question here but I'm still wondering if there is really no way to display correctly the grid.

    &#194;&#160;
    Last edited by vlafon; 14 Sep 2015, 06:50.

    #2
    Hi,
    Do you have some possible solutions to this problem?
    Even if it's not a major issue, it's quite urgent for us to solve it.
    Regards.

    Comment


      #3
      Well, I found the solution by myself.
      A field is automatically created when grouping by a field and it can be used when the grid is built.
      In my case, when I expand my SectionStackSection, I fill the grid with custom data, and I add the following line to avoid bad resizing :

      Code:
      grid.getFields()[0].setAutoFitWidth(false);
      Solved.
      Last edited by vlafon; 16 Sep 2015, 02:36.

      Comment


        #4
        The field which is automatically created is the groupTitleColumn. You can modify its properties via the 'groupTitleColumnProperties' (including disabling auto-fit if you like).
        See the docs here.

        Having said that, it's not clear why the field is getting truncated in your use case / screenshot -- the default auto-fit property should make the field fit to its content rather than clipping it and showing ellipses.
        We expanded your test code into a working test case on our end and were unable to reproduce the problem.

        If you are content to simply set autoFitWidth to false on this column, there may be no need to take this further, but if you would like us to investigate, please put together a test case we can actually run which demonstrates the problem and we'll take another look.
        This should be basically a simple EntryPoint class which creates a ListGrid with similar configuration to what you have in your app and populates it with data / demonstrates the problem. We should ideally be able to drop it into a project as the EntryPoint class and run it without modification.

        Thanks
        Isomorphic Software
        &#194;&#160;

        Comment

        Working...
        X