1 Reply Latest reply on Sep 26, 2010 8:16 AM by ArrowUpRight

    an Array of ValueObject data fields

    ArrowUpRight Level 2

      Hi

      i'd like to create a function like this:

       

      for each (var dataField in valueObject) {...add it into array...}

       

      This is how i'd like to realise it, but i think it is something another.

       

      So, i'd like to have a function with valueObject Class as a parameter to create an Array of that Class dataFields (such an ID, FirstName, LastName, Contacts and so on).

       

      Then i have to parse the values of that parameters via the ArrayCollection of many valueObjects.

       

      Or, the another solve of dilemma of "How to collect all field values of the valueObject, without using that fields names"?

       

      This would be great to use one function for different valueObjects Classes.

        • 1. Re: an Array of ValueObject data fields
          ArrowUpRight Level 2

          Woooooohhuhuhuhuhuhu!

           

                      private function filterFunc(item:Object):Boolean {
                          var itemString:String;
                     
                          for each( var obj:Object in ObjectUtil.getClassInfo(item).properties ) {
                              var prop:String = item[obj] ;
                              itemString = itemString + prop.toLowerCase();
                          }
                         
                          return itemString.indexOf(searchString) > -1;
                      }

           

          ObjectUtil.getClassInfo!!!

           

          Great! Thank everybody any way.