Hi,
The following code works great. Just I want to add a Text Box to search the desired item from the huge list. Please help me in this regard.
import fl.data.DataProvider;
import fl.controls.dataGridClasses.DataGridColumn;
import flash.events.Event;
import flash.net.URLRequest;
import fl.events.ListEvent;
var COL_SLNO:DataGridColumn = new DataGridColumn("SL_NO");
myGrid.addColumn(COL_SLNO);
COL_SLNO.width=40
var COL_DATE:DataGridColumn = new DataGridColumn("DATE");
myGrid.addColumn(COL_DATE);
COL_DATE.width=130
var COL_PDFURL:DataGridColumn = new DataGridColumn("FILE_NAME");
myGrid.addColumn(COL_PDFURL);
COL_PDFURL.sortOptions = Array.NUMERIC;
COL_PDFURL.width=195
var allDatabase:Array = [];// contains all users like in xml
var currentDatabase:Array = [];// contains users that need to be displayed
var _loader:URLLoader = new URLLoader();
var _data:XML = new XML();
_loader.addEventListener(Event.COMPLETE, readXML);
_loader.load(new URLRequest("EHSSDocs/Database.xml"));
function readXML(event:Event):void
{
_data = new XML(event.target.data);
for each (var usr in _data.user)
{
allDatabase.push({id: usr.@id, SLNO: usr.@SLNO, DATE: usr.@DATE, PDFURL: usr.@PDFURL});
}
currentDatabase = allDatabase.concat();
updateList();
}
function updateList():void
{
myGrid.dataProvider = new DataProvider ();
for (var i:int = 0; i<currentDatabase.length; i++)
{
myGrid.addItem({SL_NO: currentDatabase*.SLNO, DATE: currentDatabase*.DATE, FILE_NAME: currentDatabase*.PDFURL});
}
//myGrid.addEventListener(Event:ListEvent.ITEM_CLICK, gridItemClick);
myGrid.addEventListener(ListEvent.ITEM_CLICK , gridItemClick);
function gridItemClick (e:ListEvent):void
{
var urlR:URLRequest=new URLRequest(e.target.getItemAt(e.rowIndex).FILE_NAME)
navigateToURL(urlR, "_blank");
}
}
Thanks in advance for any help.