I did some sniffin around and got mine to work right.  For anyone interested I made a kinda generic version below.

// sourceArray = any array you are currently using as a datasource, most likely it will be preloaded with entries
// search = the ID of the text entry field you want to use while typing
private function filterlist() {
    var TempObject:Object = new Object(); // This will hold a source structure
    var RunningArray:Array = new Array(); // This will become the new dataSource for the datagrid
    var compString:String = new String(); // This will have just the element of the TempObject you want to test
    // Start Looping over the original datasource
    for(var i=0; i < sourceArray.length; i++){
     TempObject =
sourceArray[i]; // Assign the current source row structure to the TempObject
     compString = TempObject.TITLE; // Assign the comp(are)String to the Element you want to filter on
    // check of the text property of most likly a text field, if it is in the compString
     if ( compString.indexOf(String(search.text)) >= 0 ) {
         RunningArray.push(TempObject); //If it is a match, add the row from the source to the filtered array
        }
    }
    destinationDataGrid.dataProvider = RunningArray; // Rebind the DataGrid to the new filtered array
   
destinationDataGrid.dataProvider.dispatchEvent({type: "modelChanged"}); // Dont know if this is needed, may work without.
}

No wildcards or anything like that are needed, esentialy its just like searching with the astrix wild character on each end of whatever you type.  Its pretty fast since the data is already loaded into memeory

Hope this helps someone



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to