Announcement

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

    ListGrid.setCanAutoFitFields(true) not the same as plain ListGrid at 1st call

    Hi Isomorphic,

    I'm using ListGrid.setCanAutoFitFields(true);
    When I use the function all the fields get very small (data dependent). This is especially true for createRecordComponent-fields.
    When I persist these via ListGrid.getFieldState() and restore these later, all my fields are very small (just as before).
    I'd like a function that resets a ListGrid to what it has been on the 1st call (when no AutoFit and no FieldState were applied). Is that somehow possible?

    I'd expect AutoFit to behave like this, but it does not. Do you have some advice here?

    Thank you,
    Blama

    #2
    It's not really clear what you mean - fieldState will not contain sizes for fields where autofitting is enabled (because they need to autofit each time, not just once).

    So if you are seeing the fields being small, that presumably means they still contain small data, which is correct operation. And they would have that size regardless of whether setFieldState had been called, so you are already in the state you're asking to restore.

    Comment


      #3
      Hi Isomorphic,

      sorry for the unclear report. It has nothing to do with ViewState in particular. It is about the way autofitting works.
      • When you open a ListGrid for the 1st time, you'd expect it to be somehow "autofitted" (meaning designed in the best possible way).
      • Then you resize columns, get scrollbars because of this and
      • resize more and more and
      • finally are not happy with the way your LG looks.
      • This is no problem without persisted ViewStates. A page reload (or destroy() and new ...) will solve it.
      • This is not true with auto applied ViewStates on load or if you just want to get back the way the LG looked when opening without "powercycling" it.
      • So you call autofit via the menu and expect it to look like at the start (because in both cases the framework has to reasonably divide the available space).
      • But with the context menu, the way it looks is different.

      See also the attached screenshots from this sample.

      I'm looking for a way to get back the look you get when showing the ListGrid for the 1st time.

      Best regards,
      Blama
      Attached Files
      Last edited by Blama; 14 Feb 2014, 02:59.

      Comment


        #4
        Hi Isomorphic,

        I just saw setAutoFitFieldsFillViewport() in someone else's code.

        From the name and the JavaDocs it is what I'm looking for.

        Best regards,
        Blama

        Comment


          #5
          Hi Isomorphic,

          I just tried and I'm afraid, it's not what I'm looking for, even not with setAutoFitWidthApproach(AutoFitWidthApproach.BOTH);.

          Could you tell me how to configure a ListGrid in a way that the column's contextmenu's "Auto Fit All Columns" renders the grid like on the 1st creation (whole viewport divided reasonably over all columns)?

          Thank you,
          Blama

          Comment


            #6
            Hi Isomorphic,

            do you have any pointers on this?
            All I want to do is to get the look from the 1st opening of a ListGrid via the ListGrid's contextmenu.

            Best regards,
            Blama

            Comment


              #7
              We don't have an API to reset the field widths to whatever they were when the ListGrid was first rendered.
              The easiest way to achieve this in application code is probably to use setFields() to re-apply the initial fields array in your application code.
              This will then re-evaluate how the default specified widths (whether an explicit number or unset / "*") should be translated to actual sizes.

              Regards
              Isomorphic Software

              Comment

              Working...
              X