Flex 中 Datagrid 的 NumberFormat 列
我正在使用 XML 作为数据源填充我的数据网格。我需要使用数千个分隔符来格式化数字列。因此,我创建了一个
但我无法在下面的代码中使用它。 (请参阅注释 //Format Numbers using numberFormatter)
for each(var item in fieldsXMLListNew){
//Copy all columns in to a proxy
var dgColumns:Array = myGrid.columns;
//create a new dynamic Column
var aColumn:DataGridColumn = new DataGridColumn();
// add parameters
aColumn.dataField = '@' + item.attribute("field");
if (item.attribute("data_type") == "N"){ //Numeric Fields Only
//Sort Numeric Columns
aColumn.sortCompareFunction = xmlDataGridNumericSorter(item.attribute("field").toString());
//Format Numbers using numberFormatter
setNumberFormat.format(item.attribute("field").toString());
}
aColumn.headerText = item.attribute("header_text");
//add to proxy
dgColumns.push(aColumn);
//copy all in to Data Grid columns again.
myGrid.columns = dgColumns;
}
对此代码进行任何调整以使其采用数字格式吗?
I am filling my datagrid using XML as datasource. I need to format the numeric columns with thousands of separators. Thus I have created a <mx:NumberFormatter id="setNumberFormat" .../>
But I fail to use it in the code below. (See the comment //Format Numbers using numberFormatter)
for each(var item in fieldsXMLListNew){
//Copy all columns in to a proxy
var dgColumns:Array = myGrid.columns;
//create a new dynamic Column
var aColumn:DataGridColumn = new DataGridColumn();
// add parameters
aColumn.dataField = '@' + item.attribute("field");
if (item.attribute("data_type") == "N"){ //Numeric Fields Only
//Sort Numeric Columns
aColumn.sortCompareFunction = xmlDataGridNumericSorter(item.attribute("field").toString());
//Format Numbers using numberFormatter
setNumberFormat.format(item.attribute("field").toString());
}
aColumn.headerText = item.attribute("header_text");
//add to proxy
dgColumns.push(aColumn);
//copy all in to Data Grid columns again.
myGrid.columns = dgColumns;
}
Any tweaking to this code so that it takes the number format?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在所需的每一列中使用 labelFunction,分配 labelFunction:
labelFunction:
Use labelFunction in each column that you want, assinging the labelFunction:
The labelFunction: