【问题标题】:column resize in flex 3flex 3中的列调整大小
【发布时间】:2009-10-16 08:20:43
【问题描述】:

看看这段代码(不能贴在这里它不适合)它代表了我真正的应用程序结构: mxml source code

编辑:代码的相关部分:

     <mx:VBox width="100%" height="100%">
      <mx:HBox width="100%" horizontalScrollPolicy="off" height="100%">  
        <mx:VBox width="100%" verticalScrollPolicy="off" height="100%">
          <mx:DataGrid height="100%" headerHeight="40" width="100%" wordWrap="true">

            <mx:columns>
              <mx:DataGridColumn dataField="serial_number" minWidth="60" 
                width="60" headerText="serial number"/>
              <mx:DataGridColumn dataField="int_number" minWidth="80"
                width="80"    headerText="int. number"/>
              <mx:DataGridColumn dataField="ext_number" minWidth="200"
                width="200"    headerText="ext. number"/>
              <mx:DataGridColumn dataField="desc" minWidth="200"
                headerText="description"/>
              <mx:DataGridColumn dataField="issued_by" minWidth="100"
                 width="100"    headerText="issued by"/>
              <mx:DataGridColumn dataField="contractual_date" minWidth="85"
                width="85"    headerText="contractual date" />
              <mx:DataGridColumn dataField="file_size" minWidth="60"   
                width="60"    headerText="file size"/>
              <mx:DataGridColumn dataField="n_sheets" minWidth="60"   
                width="60"    headerText="n. of sheets"/>
              <mx:DataGridColumn dataField="contains_drawing" minWidth="65"
                width="65"    headerText="contains drawing"/>
              <mx:DataGridColumn dataField="issue_at_shipment" minWidth="65"
                width="65"     headerText="issue at shipment"/>
              <mx:DataGridColumn dataField="rev_max_int_number" minWidth="65"
                width="65"      headerText="last rev"/>
            </mx:columns>

          </mx:DataGrid>
        </mx:VBox>
      </mx:HBox>
    </mx:VBox>

这是您可以在线查看的编译版本: compiled swf

现在.. 稍微调整一下窗口的大小,看看这些列的大小调整得多么奇怪!我想要获得的行为是固定除描述列之外的所有列,我没有指定宽度,只指定了 minWidth 属性。

谢谢

【问题讨论】:

    标签: apache-flex actionscript datagrid resize


    【解决方案1】:

    我会说将宽度绑定到您想要的值,这样它就不会调整大小:

    var mySize:int = 60;
    <mx:DataGridColumn width="{mySize}" />
    

    告诉我,谢谢!

    【讨论】:

    • maxWidth 不存在.. 另一个解决方案相当于直接分配它,除非我每隔几毫秒以某种方式调度 mySize var.. 这不好!
    • 好吧,mySize 绑定到 datagridcolumn 的宽度 .. 所以它不会总是通过 mySize 来查看和模拟它的值吗?
    【解决方案2】:

    只是为了将来的搜索:在 (3.5b SDK) DataGrid 添加到显示列表(也称为动态添加的列)之后添加的列上设置 minWidth 会使整个网格处于非常糟糕的状态,其中水平滚动条拇指不准确地反映了比实际存在的更宽的网格。

    如果通过将列对象(设置了 .minWidth)推送到数组并将该数组分配给 DataGrid.columns 来添加列,则网格的行为就像它认为它比实际更宽:

    • 它把自己画得尽可能宽(忽略任何 .right 或 .width 值)
    • 它的水平滚动条拇指比可见宽度显示的宽
    • 无法滚动以使最右侧的列可见
    • 滚动可以做的很慢

    解决方案是:不要那样做(使用 .minWidth 属性,即)。

    干杯

    【讨论】:

      猜你喜欢
      • 2011-05-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-14
      • 1970-01-01
      • 2018-12-21
      • 1970-01-01
      相关资源
      最近更新 更多