2 Replies Latest reply on Aug 5, 2010 11:22 AM by GeorgeWS

    Filtering

    GeorgeWS Level 1

      I have a DG that I select a row and I get the result in a textInput box in another component.

       

       

      <mx:TextInput id="myText" text="{parentDocument.selectedItem.employeeid}" valueCommit="myProxy.refresh()"/>

       

      This shows me the employeeid that was selected. I now what a DG that is in this component. To filter on whats in the myText textbox.

       

      This is my filter statement:

       

      [Bindable] public var myProxy:ArrayCollection;

       

       

      public function handleQueryResult7(event:ResultEvent):void{

      myProxy=event.result as ArrayCollection;

      myProxy.filterFunction=processFilter;

      }

       

       

      public function processFilter(item:Object):Boolean {

       

      if (myText.text == item.Proxy || item.Proxy == "") {

       

      return true;

      }

      else {

       

      return false;

      }

      }

       

       

      I can tell that the arraycollection gets refreshed and if there are any recorts that are blank they get filtered if i pick an emplyeeid that is blank. But the DG just goes blank when I select a row.

       

      My DG is like this:

       

      <mx:DataGrid

       

      id="dgSelected" dataProvider="{myProxy}" dragEnabled="true" dragMoveEnabled="true" dropEnabled="true" dragDrop="addToCart(event);" allowMultipleSelection="true" height="100%" width="100%">

       

      <mx:columns>

       

      <mx:DataGridColumn

      headerText="

      First Name"

      dataField="

      firstname"/>

       

      <mx:DataGridColumn

      headerText="

      Last Name"

      dataField="

      lastname" />

       

      <mx:DataGridColumn

      dataField="

      Proxy" />

       

      </mx:columns>

       

      </mx:DataGrid>

       

       

      The Fields are Char type

       

      Thanks

       

      George