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

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

问题描述

我正在提取 xml 数据以确定哪些列是可见的,以及每列的宽度.我的数据网格的宽度可以更改,因为它位于 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天全站免登陆