整个页面全粘出来了!
费时费力啊,整了好长时间,不知道还有没有别的好的方法。。。
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/03/07/performing-case-insensitive-sorts-using-the-datagrid-control-in-flex/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Script>
<![CDATA[
import mx.collections.Sort;
import mx.utils.ObjectUtil;
import mx.utils.StringUtil;
public function isIn(min:int,max:int,n:int):Boolean{
return min<=n && max>=n;
}
public function convertChar(chineseChar:String):String
{
if(chineseChar!=null){
var bytes:ByteArray = new ByteArray
var str:String;
for(var i:int=0;i<chineseChar.length;i++){
bytes.writeMultiByte(chineseChar.charAt(i), "cn-gb");
var n:int = bytes[i] << 8;
n += bytes[i+1];
if (isIn(0xB0A1, 0xB0C4, n))
str=str+"a";
if (isIn(0XB0C5, 0XB2C0, n))
str=str+"b";
if (isIn(0xB2C1, 0xB4ED, n))
str=str+"c";
if (isIn(0xB4EE, 0xB6E9, n))
str=str+"d";
if (isIn(0xB6EA, 0xB7A1, n))
str=str+"e";
if (isIn(0xB7A2, 0xB8c0, n))
str=str+"f";
if (isIn(0xB8C1, 0xB9FD, n))
str=str+"g";
if (isIn(0xB9FE, 0xBBF6, n))
str=str+"h";
if (isIn(0xBBF7, 0xBFA5, n))
return "j";
if (isIn(0xBFA6, 0xC0AB, n))
str=str+"k";
if (isIn(0xC0AC, 0xC2E7, n))
str=str+"l";
if (isIn(0xC2E8, 0xC4C2, n))
str=str+"m";
if (isIn(0xC4C3, 0xC5B5, n))
str=str+"n";
if (isIn(0xC5B6, 0xC5BD, n))
str=str+"o";
if (isIn(0xC5BE, 0xC6D9, n))
str=str+"p";
if (isIn(0xC6DA, 0xC8BA, n))
str=str+"q";
if (isIn(0xC8BB, 0xC8F5, n))
str=str+"r";
if (isIn(0xC8F6, 0xCBF0, n))
str=str+"s";
if (isIn(0xCBFA, 0xCDD9, n))
str=str+"t";
if (isIn(0xCDDA, 0xCEF3, n))
str=str+"w";
if (isIn(0xCEF4, 0xD188, n))
str=str+"x";
if (isIn(0xD1B9, 0xD4D0, n))
str=str+"y";
if (isIn(0xD4D1, 0xD7F9, n))
str=str+"z";
}
return str;
}
return null;
}
private function value_sortCompareFunc(itemA:Object, itemB:Object):int {
if (!itemA.hasOwnProperty("value")) {
itemA.value = null;
}
// Make sure itemB has a "value" property.
if (!itemB.hasOwnProperty("value")) {
itemB.value = null;
}
var str1:String= convertChar(itemA.value);
var str2:String=convertChar(itemB.value);
return ObjectUtil.stringCompare(str1, str2, checkBox.selected);
}
]]>
</mx:Script>
<mx:ArrayCollection id="arrColl">
<mx:source>
<mx:Array>
<mx:Object index="1" value="阿董" />
<mx:Object value="董珍宝" />
<mx:Object index="40" value="段远" />
<mx:Object index="200" value="滨河村" />
<mx:Object index="3" value="曹非" />
<mx:Object index="5" />
</mx:Array>
</mx:source>
</mx:ArrayCollection>
<mx:ApplicationControlBar dock="true">
<mx:CheckBox id="checkBox"
label="case insensitive search:"
labelPlacement="left"
selected="true" />
</mx:ApplicationControlBar>
<mx:DataGrid id="dataGrid" dataProvider="{arrColl}">
<mx:columns>
<mx:DataGridColumn dataField="index"/>
<mx:DataGridColumn dataField="value" sortCompareFunction="value_sortCompareFunc"/>
</mx:columns>
</mx:DataGrid>
</mx:Application>
分享到:
相关推荐
如何改变Flex中DataGrid某一DataGridColumn显示内容的字体颜色
用得多了,发觉自己了解的真的是九牛之一毛都没有,最近用到了从后台读出数据时显示的问题,相信很多人都有用整形数据来代替字符串数据的情况
flex中动态添加复选框(checkBox)。
Flex datagrid 不可以设置列宽,用这个试试吧,hehe
<![CDATA[ ... <mx:DataGridColumn headerText="names" dataField="names" width="200" /> <mx:DataGridColumn headerText="sex" dataField="sex" width="300" /> </mx:WindowedApplication>
重写DataGridColumn,使得VS2003的DataGrid有和DataGridView中的单元格有类似的显示样式
绝对好东西,datagrid 标题栏及 datagridcolumn 添加 checkbox
解析数据用了flex的JSON包。 这段代码放在要显示树的canvas下 rootLable="根节点" //树的根节点名 destination="flexService" //remoteObject 的destination remoteServer="true" id="asyntree1" ...
var dataGridColumn:DataGridColumn = new DataGridColumn(arrData[2]); dataGridColumn.headerText=arrData[0]; dataGridColumn.width=150; dataGridColumn.editable=false; var arrays:Array = new Array(); ...
flex 导出excel工具包 用法如下: import com.as3xls.xls.ExcelFile; import com.as3xls.xls.Sheet; import mx.collections.ArrayCollection; import mx.controls.DataGrid; import mx.controls.dataGridClasses....
26.您要创建一个ASP.NET应用程序在DataGrid控件中显示一个经过排序的列表。产品数据被存放于一个名为PubBase的Microsoft SQL Server 数据库。每个产品的主键是ProductID,Numeric型并且每个产品有一个字母描述字段,...
Blazor.DataGrid 通用的Blazor网格,用于显示数据,从头开始编写而无需JS。 主要特点: 资料筛选资料编辑多种分类多级分组多记录选择(Shift +单击“全选”以单击,Ctrl +单击“添加单击以单击以选择”) 您可以在...
Page1的ListView是别人的代码。... ObservableCollection<DataGridColumn> collec=new ObservableCollection<DataGridColumn> ();我们控件不是listview类型的,所以不能 public GridViewColumnCollection collec;。
Xamarin.Forms.DataGrid Xamarin.Forms应用程序的DataGrid库。 您可以从NuGet程序包管理器安装程序包 pm > Install-Package Xamarin.Forms.DataGrid 支持平台安卓的iOS 超人 用法() 从Xaml使用之前,应先调用...
列:DataGridColumn[]; export interface IDataGridColumn extends ICol { colIndex ?: number ; rowIndex ?: number ; formatter ?: formatterFunction | string ; collector ?: collectorFunctio