Flex 3 DataGrid列宽问题 [英] Flex 3 DataGrid Column Width Problem

查看:203
本文介绍了Flex 3 DataGrid列宽问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在拉xml数据以确定哪些列是可见的,每列的宽度。我的datagrid的宽度可以改变它在HDividedBox的一边。可见性部分起作用,但设置宽度会导致头痛。代码:

  for(循环通过从XML中检索列数据)
{
newData [i ] = dg.columns [Number(columnsOrder [i]) - 1];
newData [i] .visible =(Number(columnsVisibility [i])== 1);
newData [i] .width = Number(columnsWidth [i]);
trace(newData [i] .headerText +w:+ newData [i] .width.toString()+v:+ newData [i] .visible.toString());
}
dg.columns = newData;
dg.invalidateList();

在跟踪中,前两个项目的宽度是正确的,但是它显示为20 连续一个...

 日期w:240 v:true 
标题w:184 v:true
请求者w:20 v:true
批准者w:20 v:true
类别w:20 v:false
状态w:20 v:false
优先级w:20 v:false

当我输出Number(columnsWidth [i])时,它显示为正确的值,所以在宽度的分配中发生了奇怪的事情。



现在已经看了几个小时,并尝试了多个事情来尝试修复它没有用。

解决方案



我的数据网格的宽度可以改变它的一个HDividedBox的一面。



那就是问题。



当DataGrid的宽度不固定时,我面对与Flex 2和Flex 3 DataGridColumn宽度完全相同的问题。我唯一的解决方法是修复DataGrid的宽度或切换到AdvancedDataGrid或其他类似的组件。


I'm pulling xml data to determine which columns are visible, and the widths of each column. My datagrid's width can change sinces its on one side of a HDividedBox. The visibility part works, but setting the width is causing headaches. Heres the code:

for(loop through column data retrieve from XML)
{ 
    newData[i] = dg.columns[Number(columnsOrder[i]) - 1];
    newData[i].visible = (Number(columnsVisibility[i]) == 1);
    newData[i].width = Number(columnsWidth[i]);
    trace(newData[i].headerText + " w:" + newData[i].width.toString() + " v:" + newData[i].visible.toString());
}
dg.columns = newData;
dg.invalidateList();

In the trace the width is correct for the first two items, however, its showing up as "20" for ever consecutive one...

Date w:240 v:true
Title w:184 v:true
Requestor w:20 v:true
Approved By w:20 v:true
Category w:20 v:false
Status w:20 v:false
Priority w:20 v:false

When I output Number(columnsWidth[i]) it shows up as the correct value so something weird is happening in the assignment of the width.

Been looking at this for a few hours now, and have tried multiple things to try to fix it to no avail.

解决方案

My datagrid's width can change sinces its on one side of a HDividedBox.

That's the problem right there.

I faced the exact same problem with Flex 2 and Flex 3 DataGridColumn width's whenever the width for the DataGrid was not fixed. The only solution I had was to fix the width of the DataGrid or switch to AdvancedDataGrid or other similar components.

这篇关于Flex 3 DataGrid列宽问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆