@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/mx";
@font-face {
src: url("../../../../../Assets/Fonts/Open_Sans/OpenSans-Regular.ttf");
fontFamily: MyVera;
embedAsCFF: true;
}
@font-face {
src: url("../../../../../Assets/Fonts/Open_Sans/OpenSans-Italic.ttf");
fontFamily: MyVera;
fontStyle: italic;
embedAsCFF: true;
}
@font-face {
src: url("../../../../../Assets/Fonts/Open_Sans/OpenSans-Bold.ttf");
fontFamily: MyVera;
fontWeight: bold;
embedAsCFF: true;
}
@font-face {
src: url("../../../../../Assets/Fonts/Open_Sans/OpenSans-Regular.ttf");
fontFamily: MyVeraHalo;
embedAsCFF: false;
}
@font-face {
src: url("../../../../../Assets/Fonts/Open_Sans/OpenSans-Italic.ttf");
fontFamily: MyVeraHalo;
fontStyle: italic;
embedAsCFF: false;
}
@font-face {
src: url("../../../../../Assets/Fonts/Open_Sans/OpenSans-Bold.ttf");
fontFamily: MyVeraHalo;
fontWeight: bold;
embedAsCFF: false;
}
s|DataGrid s|GridColumnHeaderGroup{
fontAntiAliasType: "normal";
fontFamily: MyVera;
fontLookup: "embeddedCFF";
}
global{
fontFamily: MyVera;
fontAntiAliasType: normal;
kerning: "off";
}
=0; i--)
dataGrid.dataProvider.removeItemAt(i + startIndex);
}
/**
* this method is to update dataGrid item on itemIndex=index, it sets property 'firstName' to 'blablabla'
*/
public function updateItems(grid:DataGrid,index:int):void
{
var obj:Object=grid.dataProvider.getItemAt(index);
obj['firstName']="blablabla";
trace(grid.dataProvider.getItemAt(index)['firstName']);
grid.dataProvider.itemUpdated(grid.dataProvider.getItemAt(index),"firstName",grid.dataProvider.getItemAt(index)['firstName'],"blablabla");
}
/**
* this method is to replace datagrid item which index=index parameter, new item is newly created on
*/
public function replaceItems(grid:DataGrid,index:int):void
{
grid.dataProvider.setItemAt(this.createItem(index+1000),index);
}
/**
* this method is to replace datagrid item which index=index parameter, new item is newly created on
*/
public function replaceItems2(grid:DataGrid,index:int,newItem:Object):void
{
grid.dataProvider.setItemAt(newItem,index);
}
/**
* this method is to apply sort on dataGrid based on dataGrid item field=fieldName.
* it handls the dataGrid is ArrayCollection or XMLListCollection two cases
*/
public function applySort(grid:DataGrid,fieldName:String, descending:Boolean=false):void
{
var sortField:SortField;
var mySort:Sort=new Sort();
if (grid.dataProvider is ArrayCollection)
{
ArrayCollection(grid.dataProvider).sort = mySort;
sortField=new SortField(fieldName);
sortField.setStyle("locale", "en-US");
sortField.descending=descending;
ArrayCollection(grid.dataProvider).sort.fields = [sortField ];
ArrayCollection(grid.dataProvider).refresh();
}else if (grid.dataProvider is XMLListCollection)
{
XMLListCollection(grid.dataProvider).sort = mySort;
sortField=new SortField("@"+fieldName);
sortField.setStyle("locale", "en-US");
sortField.descending=descending;
XMLListCollection(grid.dataProvider).sort.fields = [sortField ];
XMLListCollection(grid.dataProvider).refresh();
}
}
/**
* this method is to apply sort on a list based on field=fieldName.
* it handls the IList is ArrayCollection or XMLListCollection two cases
*/
public function applySortOnList(dp:IList,fieldName:String, descending:Boolean=false):void
{
var sortField:SortField;
var mySort:Sort=new Sort();
if (dp is ArrayCollection)
{
ArrayCollection(dp).sort = mySort;
sortField=new SortField(fieldName);
sortField.setStyle("locale", "en-US");
sortField.descending=descending;
ArrayCollection(dp).sort.fields = [sortField ];
ArrayCollection(dp).refresh();
}else if (dp is XMLListCollection)
{
XMLListCollection(dp).sort = mySort;
sortField=new SortField("@"+fieldName);
sortField.setStyle("locale", "en-US");
sortField.descending=descending;
XMLListCollection(dp).sort.fields = [sortField ];
XMLListCollection(dp).refresh();
}
}
/**
* this method is a filter method based on filterText which is a global variable.
* it handles an item is either object or XML
*/
public function includeFirstNameContain( item:Object ):Boolean
{
if (item is XML)
{
if (filterText.indexOf("*")>-1)
return true;
if( (XML(item).@firstName).indexOf(filterText)>-1)
return true;
else return false;
}else
{
if( String(item["firstName"]).indexOf(filterText)>-1)
return false;
else return true;
}
}
// set the filter function on the collection
public function applyFilter(grid:DataGrid):void
{
if (grid.dataProvider is ArrayCollection)
{
ArrayCollection(grid.dataProvider).filterFunction = includeFirstNameContain;
ArrayCollection(grid.dataProvider).refresh();
}else if (grid.dataProvider is XMLListCollection)
{
XMLListCollection(grid.dataProvider).filterFunction = includeFirstNameContain;
XMLListCollection(grid.dataProvider).refresh();
}
}
/**
* this method is a helper method, try to create an arrayList with rowIndex/columnIndex
*/
public function addSelectedCellRegion(rows:Vector., columnIndex:int, columnCount:int):ArrayList
{
var selectedCellInfo:ArrayList=new ArrayList();
var len:int=rows.length;
var rowIndex:int;
for (var i:int=0;i):ArrayList
{
var rowsHolder:ArrayList=new ArrayList();
var len:int=v.length;
var obj:Object;
for (var i:int =0;i
{
var v:Vector.=new Vector.;
var t:int;
var obj:Object;
for (var i:int =0;i
{
var v:Vector.