Announcement

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

    Min listgridfield width?

    Is it possible to specify a minimum listgridfield width, yet still allow it to take as much as space as available when there's a large computer screen (ie set it to setwidth("*") and also have min width)? I couldn't find a way to do this for a listgridfield.

    Miscellaneous Infrastucture Details:
    ==================================
    OS: Windows XP Pro
    IDE: MyEclipse 10.0 with Google Plugin for Eclipse (2.5)
    SmartGWT Pro 3.0 (Purchased Licence)
    Browser: Mozilla Firefox 4.0.1
    GWT SDK: 2.4.0
    Sun JDK 1.6.0_27

    #2
    You can't do precisely what you describe, but you can do similar things which may be better than you were hoping for. Specifically:

    1. You can autofit a field to it's title or value with listGridField.autoFitWidth and leave it's width as "*". Here the minimum width is the title or value rather than a pixel width as it seems like you may want.

    2. When using listGrid.autoFitFieldWidths, listGridField.width is taken as a minimum width. Then, one field can be designated as the listGrid.autoFitExpandField so it takes up remaining space

    3. You can set a minimum width for all fields with listGrid.minFieldWidth

    Comment


      #3
      So #1 almost works well-enough, except for one issue, which I believe is a bug:

      If row numbers are turned on, then the rownumber column ends up eating up all the available space. (Curiously, it even eats up all the available space even if one the other "real" fields is set to "*" for its column width -- that is, the rownumber column doesn't even split up the available width with any field whose width is set to "*"). This problem disappears if I turn off rownum.

      So, I though I could fix this by explicitly setting the field width of the rownumber field, by following the script outlined here: http://forums.smartclient.com/showthread.php?t=10764

      However, this did not work. The code I used was as follows:

      Code:
      lgSummary.setShowRowNumbers(true);
      lgSummary.setAutoFitFieldWidths(true);
      		
      ListGridField z = new ListGridField();
      z.setWidth(120);
      z.setTitle("#");
      lgSummary.setRowNumberFieldProperties(z);
      (FYI: As well, the listgrid would not obey my title command for the row number column. This is minor, but I thought I'd mention it as well.)

      Comment


        #4
        Addendum:

        Actually, turning off rownumber only avoids this problem if the listgrid does not have the ability to "expand component" (ie setCanExpandRecords(false)). If setCanExpandRecords(true), then the column that holds the "triangle" symbol denoting the expansion of the row will consume all the available width. And I don't think there's anyway to explicitly control the "expansion column" size etc either.

        Comment


          #5
          Ok, so I solved it by using a combination of Isomorphic suggestion #1 and #2.

          Essentially, it seemed necessary to both set the listgrid's autofitwidth to true **and** to explicitly set the listgrid's setAutoFitExpandField to true. (Just setting a fields width to "*" is not sufficient if one has rownumbers and/or expansion components in the listgrid.) Here's the code that worked:

          Code:
          lgProteins.setCanDragSelectText(true);
          lgProteins.setAutoFitFieldWidths(true);
          lgProteins.setAutoFitFieldsFillViewport(true);
          lgProteins.setAutoFitWidthApproach(AutoFitWidthApproach.BOTH);
          lgProteins.setAutoFitExpandField("group_protein_description");

          Comment


            #6
            Can you post settings that need to be applied to a sample to reproduce the rowNumber column expanding? We're not seeing this effect.

            Also please use the fully patched version (see SmartClient.com/builds), or if you are already, please post the full version.

            Comment


              #7
              Full Infrastucture Details:
              ==================================
              SmartGWT Version: SC_SNAPSHOT-2011-12-05/PowerEdition Deployment (built 2011-12-05)

              OS: Windows XP Pro
              IDE: MyEclipse 10.0 with Google Plugin for Eclipse (2.5)
              Browser: Mozilla Firefox 4.0.1
              GWT SDK: 2.4.0
              Sun JDK 1.6.0_27

              Comment


                #8
                Try a recent patched build, we believe this was already fixed. If you can still get it to happen, please tell us how to modify a sample to see the problem.

                Comment

                Working...
                X