Announcement

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

    how to get listgridfield width

    Hi there,

    Create a listgridfield without setting the width, in the following code, the listgridfield.getwidth() always return null, are there any functions to get the exactly width of this field?

    Thanks.

    #2
    Either use ListGrid.getFieldWidth() or ListGrid.getFieldState()

    Comment


      #3
      I have the same problem trying to get the field widths. Neither ListGrid.getFieldWidth() nor ListGrid.getFieldState() worked, null was still returned.

      Comment


        #4
        Your problem may be that due to the layout calculations performed to size ListGrid fields, actual field widths aren't known until the ListGrid has been drawn.

        Comment


          #5
          I was calling ListGrid.getFieldState() in onDrawHandler. I tried again right after calling ListGrid.draw(), the result was the same. The only fields that had width returned were boolean type fields, the width for them were 21, and null was returned for other field types (text, text area, selectItem, etc.)

          Comment


            #6
            Any progress on this? I'm calling getFieldWidth(int) and passing in 0 as the index and I'm getting null. However, if I pass in the column's name, I get a width.

            Comment


              #7
              Thanks kevboy, you're right, ListGrid.getFieldWidth(ListGrid.getFieldName(colNum)) returns the width. This is great!

              Comment


                #8
                Awesome! I didn't think to call ListGrid.getFieldName(colNum)) to get the name then pass it to ListGrid.getFieldWidth(name). Now, I can always get the field width of a column by index! Thanks, sunshine!

                Comment

                Working...
                X