Announcement

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

    Minimized portlet - height

    Hello,

    I have a PortalLayout with some portlets in it. I want the top portlet to start out as minimized. When I do that, the portlet shows just the header in the minimized state, but has a lot of empty white space underneath it. But if I maximize it, and then minimize it after the Layout is loaded, the whitespace goes away and the layout is how I want it.

    Is there some trick to get the whitespace to go away on layout initialization? I tried setting/unsetting the height of portlets but to no avail.


    On page load it looks like this:



    Click image for larger version

Name:	p1.png
Views:	149
Size:	59.2 KB
ID:	270757


    Toggling the minimize/maximize button and it looks like this:


    Click image for larger version

Name:	p2.png
Views:	118
Size:	51.9 KB
ID:	270758




    #2
    Hi Pablo,

    Please let us know what product & version you're using (always required when posting here).

    Then, if you can create a simple test case - ideally just code that can be pasted into the Showcase to see the result you're seeing - that would be ideal in terms of reproducing the issue so that we can understand whether there is a usage issue vs possible framework bug or needed enhancement.

    Comment


      #3
      I am using the SmartGWT jar. I probably should have posted this in the other forum.

      SmartClient Version: v13.0p_2023-06-06/LGPL Development Only (built 2023-06-06)


      Code is below. I didn't include the code for createGrid() but it basically just creates a ListGrid with some data and sets its height to 500.


      Code:
      public Canvas getMainPanel()
          {
              PortalLayout layout = new PortalLayout();
              layout.setWidth100();
              layout.setHeight100();
              layout.setShowColumnMenus(false);
              Portlet top = new Portlet();
              Portlet bottom = new Portlet();
              top.addItem(createGrid());
              bottom.addItem(createGrid());
      
              top.setMinimized(true);
      
              layout.addPortlet(top, 0, 0);
              layout.addPortlet(bottom, 0, 1);
      
              return layout;
          }
      Last edited by pablo99; 18 Aug 2023, 11:09.

      Comment


        #4
        Hi Pablo - wrong forum (this is SmartGWT code and you're in the SmartClient forum) but that's fine, we can answer here.

        Unfortunately we do need to see createGrid() as there are many things that could be in that code which would influence behavior.

        It's fine to just lift code from the Showcase for creating a similar grid, instead of having to make your code runnable for us.

        Thanks.

        Comment


          #5
          createGrid() code below:

          Code:
          private ListGrid createGrid()
              {
                  final ListGrid grid = new ListGrid();
          
                  ArrayList<ListGridField> fields = new ArrayList<ListGridField>();
          
                  for (int i = 0; i < 10; i++)
                  {
                      ListGridField f = new ListGridField("f" + i);
                      f.setWidth(100);
                      f.setCanEdit(true);
                      fields.add(f);
                  }
          
                  grid.setFields(fields.toArray(new ListGridField[0]));
          
                  ArrayList<ListGridRecord> records = new ArrayList<ListGridRecord>();
                  for (int i = 0; i < 100; i++)
                  {
                      ListGridRecord record = new ListGridRecord();
                      for (int j = 0; j < 10; j++)
                      {
                          record.setAttribute("f" + j, 1);
                      }
                      records.add(record);
                  }
                  grid.setRecords(records.toArray(new ListGridRecord[0]));
                  grid.setHeight(500);
                  grid.setWidth100();
          
                  return grid;
              }

          Comment


            #6
            hi Pablo,

            We do see an issue here and it's been assigned to be fixed.

            In the meantime, you can fix it by just using setPortlets(top, bottom), rather than calling addPortlet() twice.

            With that change, you'll get one collapsed Portlet and one expanded - however, your expanded Portlet will not expand it's child-grid vertically, because you have height: 500 on the grids. If you want the grids to fill the expanded Portlet vertically, setHeight100() on the grids and apply the 500 height to the Portlet instead.

            We'll update here when we have more information about the underlying issue.

            Comment


              #7
              hi Pablo,

              We've addressed the underlying issue in branches affected by it.

              If you retry with today's build, dated August 23, you should be able to use either setPortlets(top, bottom) or separate calls to addPortlet().

              Comment


                #8
                Thanks for looking into this! I downloaded the latest jar and tested it it out. It looks good on the initial page load and the portlet is minimized as desired.

                However when i try to restore the portlet to it's normal size, it doesn't seem to work. See the image below. On restore, it allocates the space for the portlet body, but it doesn't draw the portlet borders or the content. I am using the same sample code as before.


                Click image for larger version

Name:	restore.png
Views:	180
Size:	37.9 KB
ID:	270794

                Comment


                  #9
                  We'll take another look and update here when we have more information.

                  Comment


                    #10
                    Re-testing with your exact original code, we see things working correctly with latest SGWT 13.1.

                    You might try clearing browser caches and restarting your server - if you still see issues and your test-code isn't exactly what you've posted so far, post your entire sample code.

                    Comment


                      #11
                      I tried your suggestions and its working now. Thanks!

                      Comment


                        #12
                        ​After testing it some more, I"m seeing another issue. Not sure if this is a bug or a user error on my part. Page load, everything looks fine. When I restore the minimized widget, its creates a lot of whitespace underneath it. If I don't minimize it, I don't see this happen on minimize/restore. I have a large height for the layout and am also disabled preventColumnUnderflow.


                        Code:
                        public Canvas getMainPanel()
                            {
                                PortalLayout layout = new PortalLayout();
                                layout.setWidth100();
                                layout.setHeight(10000);
                                layout.setShowColumnMenus(false);
                                layout.setPreventColumnUnderflow(false);
                                layout.setNumColumns(1);
                        
                                Portlet top = new Portlet();
                                top.setTitle("Top portlet");
                                top.setHeight(500);
                                top.setMinimized(true);
                        
                                Portlet bottom = new Portlet();
                                bottom.setTitle("Bottom portlet");
                                bottom.setHeight(500);
                        
                                top.addItem(createGrid(1));
                                bottom.addItem(createGrid(2));
                        
                                layout.addPortlet(top, 0, 0);
                                layout.addPortlet(bottom, 0, 1);
                        
                                return layout;
                            }
                        
                            private ListGrid createGrid(int n)
                            {
                                final ListGrid grid = new ListGrid();
                        
                                ArrayList<ListGridField> fields = new ArrayList<ListGridField>();
                        
                                for (int i = 0; i < 10; i++)
                                {
                                    ListGridField f = new ListGridField("f" + i);
                                    f.setWidth(100);
                                    f.setCanEdit(true);
                                    fields.add(f);
                                }
                        
                                grid.setFields(fields.toArray(new ListGridField[0]));
                        
                                ArrayList<ListGridRecord> records = new ArrayList<ListGridRecord>();
                                for (int i = 0; i < 100; i++)
                                {
                                    ListGridRecord record = new ListGridRecord();
                                    for (int j = 0; j < 10; j++)
                                    {
                                        record.setAttribute("f" + j, n);
                                    }
                                    records.add(record);
                                }
                                grid.setRecords(records.toArray(new ListGridRecord[0]));
                                grid.setHeight(500);
                                grid.setWidth100();
                        
                                return grid;
                            }


                        Page Load, everything looks good:

                        Click image for larger version

Name:	s1.png
Views:	179
Size:	39.5 KB
ID:	270811


                        Clicking restore on the minimized widget creates white space underneath:

                        Click image for larger version

Name:	s2.png
Views:	146
Size:	75.7 KB
ID:	270812

                        Comment


                          #13
                          Thanks for the modified test-code - we see the issue and will update here shortly when we have a fix in place.

                          Comment


                            #14
                            This has now been resolved. Please pick up a build dated April 22 or later to get the fix.

                            Comment

                            Working...
                            X