You need to check into a number of things...

ArrayCollection:
http://livedocs.adobe.com/flex/3/langref/mx/collections/ArrayCollection.\
html
You need to know how to filter your data. Here you will find info
regarding FilterFunction.

CheckBox:
http://livedocs.adobe.com/flex/3/langref/mx/controls/CheckBox.html
This will show you some of the events that the checkbox generates
including the change event.

String: http://livedocs.adobe.com/flex/3/langref/String.html
This will show you a few ways of doing string searches including
indexOf().

As a quick and dirty example:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="vertical"
     initialize="onInit()">
     <mx:Script>
         <![CDATA[
             import mx.collections.ArrayCollection;

             [Bindable] private var IPAddresses:ArrayCollection;

             private function onInit():void
             {
                 IPAddresses = new ArrayCollection([
                                     {IP:"192.168.1.1"},
                                     {IP:"192.168.1.2"},
                                     {IP:"192.168.1.3"},
                                     {IP:"192.168.1.4"},
                                     {IP:"192.168.1.5"},
                                     {IP:"192.168.2.1"},
                                     {IP:"192.168.2.2"},
                                     {IP:"192.168.2.3"},
                                     {IP:"192.168.2.4"},
                                     {IP:"192.168.2.5"}
                                     ]);
             }

             private function checkBoxChanged():void
             {
                 if(IPCheckBox.selected)
                 {
                     IPAddresses.filterFunction = IPFilter;
                 }
                 else
                 {
                     IPAddresses.filterFunction = null;
                 }
                 IPAddresses.refresh();
             }

             private function IPFilter(item:Object):Boolean
             {
                 var isMatch:Boolean = false;
                 if((item.IP as String).indexOf(IPTextInput.text) > -1)
                 {
                     isMatch = true;
                 }
                 return isMatch;
             }
         ]]>
     </mx:Script>
     <mx:HBox>
         <mx:CheckBox id="IPCheckBox" label="IP address"
change="checkBoxChanged()"/>
         <mx:TextInput id="IPTextInput" />
     </mx:HBox>
     <mx:DataGrid id="IPDataGrid" dataProvider="{IPAddresses}"
rowCount="{IPAddresses.length}">
         <mx:columns>
             <mx:DataGridColumn headerText="IP" dataField="IP"/>
         </mx:columns>
     </mx:DataGrid>
</mx:Application>

If there is anything about this you don't understand, please don't
hesitate to ask.


HTH.



Steve


--- In [email protected], "diana_usim" <diana_u...@...> wrote:
>
> hye....
>
> i've got a problem to build my checkbox.i have a checkbox with label
"IP address" and a text input beside it.
>
> i want to be able to input any IP address and when i click the
checkbox button it will filter the datagrid according to IP address
input earlier.it like a combination of 'search' and checkbox.but i don't
know how to do this.
>
> can you show me how to work on this one??i'm ready to learn form the
expert!!
>

Reply via email to