Hi Michael,

Haven't tried your code, but wondering if sorting the datagrid by clicking the 
headers gives you inaccurate results?

Or are you resetting the dataProvider on every sort?

Cheers,
Adam

  ----- Original Message ----- 
  From: Michael Levine 
  To: [email protected] 
  Sent: Thursday, March 22, 2007 9:44 AM
  Subject: [flexcoders] Re: How do you suppress repeating values in DataGrid 
columns?


  Thank you, everyone! I ended up solving the problem with the following code:

  /* 
      XML from HTTPService looks like this:
      
      <books>
         <book author="" title="" />
         ...
      </books>

      XMLListCollection is set as dataProvider for the DataGrid.

  */

  var books:XMLListCollection = new 
XMLListCollection(XMLList(event.result..books));
                  
  // Suppress repeating Author values
  var lastAuthor:String = "";
  var i:int = 0;
  for each (var book:XML in books) {
      if ([EMAIL PROTECTED] == lastAuthor) {
          [EMAIL PROTECTED] = "";
      }
      lastAuthor = [EMAIL PROTECTED];
      i++;
  }

  Michael

  --- In [email protected], "michael_p_levine" <[EMAIL PROTECTED]> 
wrote:
  >
  > Given data that looks like this:
  > 
  > Record #1: Author=John Doe, Title=Advanced Cat Juggling
  > Record #2: Author=John Doe, Title=Surviving Cat Scratch Fever
  > Record #3: Author=Bill Smith, Title=The Alligator Whisperer
  > Record #4: Author=Bill Smith, Title=Living With One Ear
  > 
  > How do I suppress the repeating Author name values in Rows #2 and #4 of
  > a DataGrid so it looks like this?
  > 
  > Author Title
  > ---- -- -----
  > John Doe Advanced Cat Juggling
  > Surviving Cat Scratch Fever
  > Bill Smith The Alligator Whisperer
  > Living With One Ear
  > 
  > I've checked the group archives and haven't found a real answer to this
  > question. Has anyone else encountered and solved this?
  > 
  > Thank you,
  > Michael
  >


   

Reply via email to