6 Replies Latest reply on Jun 29, 2010 6:15 AM by djh88ukwb

    Datagrid, refresh and filtering, need a bit of help


      Hello all.


      I have a datagrid.  This is populated on application creationComplete  using the following code

                  protected function application1_creationCompleteHandler():void           
                      db_services.endpoint = "http://bleh/amfphp/gateway.php";               
                      db_services.source = "jobs";           
                      db_services.destination = "amfphp";           


      My datagrid is then pulling in the data from the array as follows


                  <mx:DataGrid  width="362" height="340" itemCreationPolicy="immediate"  includeIn="clientuser" x="1" y="30" dataProvider="{YourJobsArr}" id="CU_YourJobs">
                          <mx:DataGridColumn headerText="ID:" width="42" dataField="id"/>
                          <mx:DataGridColumn headerText="Job Ref::" width="70"  dataField="jobref"/>
                          <mx:DataGridColumn headerText="Company:"  dataField="companyname"/>
                          <mx:DataGridColumn headerText="Position:"  dataField="position"/>


      There is a log in screen before the user gets to see this datagrid however, and depending on who they log in as, a filter is run across the data,  the filters is


                          YourJobsArr.filterFunction = GetYourCurrentJobs_filterFunc;


      This code is in the login success statement


                  protected function GetYourCurrentJobs_filterFunc(item:Object):Boolean
                      if (item.assignedrecruiter == LoadedID)               
                          return true    
                          return false;


      This is the filter



      Now this all works well, as i log in to different accounts they can see only the data they are supposed to.


      However i have another state where the user can add data to the mysql database, that the data is comming from.


      Now as they submit this button, i need to recall the AMFPHP script, to call the database and retreive all the informatio again, so that the added data is brought back.


      I have done this by using this on my submit button

      <s:Button x="88" y="200" label="Create Job" click="createNewJob(),application1_creationCompleteHandler();"/>


      Now the only snag here is that all the data is brought back, it is unfiltered.


      Can anyone suggest how i can then re-filter it again before its shown ?