Flex 3 中的列大小调整

发布于 2024-08-08 03:59:38 字数 2353 浏览 3 评论 0原文

看看这段代码(无法将其粘贴到此处,它不适合)它代表了我真正的应用程序结构: mxml 源代码

编辑:代码的相关部分:

     <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>

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

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

谢谢

look at this code (couldn't paste it here it doesn't fit)it represent my real app structure:
mxml source code

EDIT: the relevant part of the 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>

this is the compiled version you can view online:
compiled swf

now.. resize a bit the window, look at how oddly the colums resize! The behaviour I'd like to obtain is to have all columns fixed except for the description column, for which I haven't speified the width but only the minWidth property.

thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

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

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

让我知道,谢谢!

I would say to bind the width to the value that you want, that way it wont resize:

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

Let me know, thanks!

挖个坑埋了你 2024-08-15 03:59:38

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

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

  • 它尽可能宽地绘制自己(忽略任何 .right 或 .width 值)
  • 它的水平滚动条拇指比可见宽度更宽,这表明
  • 无法滚动以使最右边的列可见,
  • 而滚动可以使 最右边的列可见do 非常慢

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

干杯

Just a note for future searches: setting minWidth on columns added after the (3.5b SDK) DataGrid is added to a display list (aka dynamically added columns) can put the entire grid in a very bad state where the horizontal scroll bar thumb is inaccurately reflecting a wider grid than actually exists.

If one adds columns by pushing column objects (that have .minWidth set) to an array and assigning that array to DataGrid.columns, the grid acts like it thinks it is wider than it really is:

  • it draws itself as wide as possible (ignoring any .right or .width values)
  • its horizontal scroll bar thumb is wider than the visible width would indicate
  • one cannot scroll to make the right-most columns visible
  • what scrolling one can do is very slow

The solution is: don't do that (use the .minWidth property, that is).

Cheers

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文