Announcement

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

  • problems with setAutoFitWidth and setWidth("*") combo

    Using SmartGWT 5.0p v10.0p_2014-09-18
    Using Firefox 38.x

    I want to always have the fields in the listgrid fill up the entire width of the listgrid. If I use setAutoFitWidth on two of my fields and a setWidth("*") on another I was expecting the column with the setWidth("*") to fill up any space left over not used by setAutoFitWidth fields. Instead the columns don't fill up the entire width of the list grid if the width of all three fields are less than the width of the listgrid.

    I tried using setAutoFitExpandField() as well to see if that had any effect but it didnt.

    ListGridField fieldA = new ListGridField("a", "A");
    ListGridField fieldB = new ListGridField('b", "B");
    ListGridField fieldC = new ListGridField("c", "C");

    ListGrid mygrid = new ListGrid();
    mygrid.setWidth100();
    mygrid.setFixedRecordHeights(false);
    mygrid.setWrapCells(true);

    fieldA.setAutoFitWidth(true);
    fieldB.setAutoFitWidth(true);
    fieldC.setWidth("*"); // want this field to take up any unused horizontal space not needed by the first two columns.

    mygrid.setFields(fieldA, fieldB, fieldC);


  • #2
    I figured it out. To fix the issue I just needed to do the following:

    mygrid.setAutoFitExpandField("c");
    mygrid.setAutoFitFieldWidths(true);
    mygrid.setAutoFitFieldsFillViewport(true);
    fieldA.setAutoFitWidth(true);
    fieldB.setAutoFitWidth(true);
    fieldC.setAutoFitWidth(false);

    Comment

    Working...
    X