Would you like to react to this message? Create an account in a few clicks or log in to continue.


Pakistan is contributing at its best in the field of latest technologies, platforms and approaches. Here,Flex developers share their experience, knowledge and ideas to assure their best talent in the world.

Latest topics
» Advice sought on recruiting a Senior Flex developer in Lahore
how Filter XML data by Flash Builder EmptyTue May 11, 2010 2:41 pm by anjum

» steam boiler efficency calculator
how Filter XML data by Flash Builder EmptyWed Dec 23, 2009 4:55 am by imranmalik

» URLLoader and URLRequest application
how Filter XML data by Flash Builder EmptyTue Dec 15, 2009 6:01 pm by imranmalik

» Time display by ILOG ELIXIER PACKAGE
how Filter XML data by Flash Builder EmptyThu Dec 10, 2009 9:28 am by imranmalik

» how Filter XML data by Flash Builder
how Filter XML data by Flash Builder EmptySat Dec 05, 2009 6:33 pm by imranmalik

» drag and drop (Advance Data Grid to List Box)
how Filter XML data by Flash Builder EmptyThu Nov 19, 2009 7:12 pm by imranmalik

» access the xml file through HTTPService request
how Filter XML data by Flash Builder EmptySun Nov 15, 2009 11:46 am by imranmalik

» CURRENCY VALIDATOR
how Filter XML data by Flash Builder EmptyTue Nov 03, 2009 2:06 pm by imranmalik

» Synchronous Behavior
how Filter XML data by Flash Builder EmptySun Nov 01, 2009 8:04 pm by imranmalik

Social bookmarking
Social bookmarking reddit      

Bookmark and share the address of on your social bookmarking website


You are not connected. Please login or register

how Filter XML data by Flash Builder

Go down  Message [Page 1 of 1]

1how Filter XML data by Flash Builder Empty how Filter XML data by Flash Builder Sat Dec 05, 2009 6:33 pm

imranmalik



<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo" minWidth="1024" minHeight="768"
creationComplete="init1()">
<fx:Script>
<![CDATA[
import mx.collections.XMLListCollection;
import mx.controls.Alert;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
[Bindable]
public var employeeData:XMLListCollection=new XMLListCollection();
public function init1():void
{
sendReport.send();
}
public function resultHandler(event:ResultEvent):void
{
var employeeResultData:XMLList=new XMLList();
employeeResultData=event.result.employee;
employeeData.source=employeeResultData;
}
public function faultHandler(event:FaultEvent):void
{
mx.controls.Alert.show("e");
}
private function filterEmployees(item:XML):Boolean
{
var searchResult:XMLList=new XMLList();
searchResult=item.(firstname==searchTerm.text||lastname==searchTerm.text);
if(searchResult.length()>0)
{
return true;
}
else
{
return false;
}
}
public function enterHandler():void
{
if(searchTerm.text!="")
{
employeeData.filterFunction=filterEmployees;
}
else
{
employeeData.filterFunction=null;
}
employeeData.refresh();
}
]]>
</fx:Script>
<fx:Declarations>
<s:HTTPService id="sendReport" result="resultHandler(event)"
fault="faultHandler(event)"
url="Data/employees.xml" resultFormat="e4x"/>
</fx:Declarations>
<mx:AdvancedDataGrid x="78" y="104" id="adg1" designViewDataType="flat"
dataProvider="{employeeData}">
<mx:columns>
<mx:AdvancedDataGridColumn headerText="First Name" dataField="firstname"/>
<mx:AdvancedDataGridColumn headerText="Last Name" dataField="lastname"/>
</mx:columns>
</mx:AdvancedDataGrid>
<s:TextInput x="78" y="74" width="302" id="searchTerm" enter="enterHandler()"/>
</s:Application>
//////////////XML FILE in SRC/data/employees.xml///////////////
<employees>
<employee>
<firstname>MUHAMMAD</firstname>
<lastname>IMRAN</lastname>
<id>DSC02305</id>
<title>prsident</title>
</employee>
<employee>
<firstname>MUHAMMAD</firstname>
<lastname>abbas</lastname>
<id>DSC0230688</id>
<title>student</title>
</employee>
<employee>
<firstname>MUHAMMAD</firstname>
<lastname>asif</lastname>
<id>DSC02309</id>
<title>minister</title>
</employee>
</employees>

http://www.jumusic.tv

Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum