2 Replies Latest reply on Dec 1, 2006 6:55 AM by jsevlie

    DataGrid, HTML Text, and WORD WRAPPING

    jsevlie
      I have a datagrid, with 2 columns:
      - comment
      - date

      The dataprovider that feeds the datagrid is an array collection, with each object containing the following fields:
      - comment
      - date
      - viewed

      What I want to do is BOLD the comment cell if the comment has not yet been viewed. What I first tried doing was to just insert the <b></b> tags on the server and then feed them up to Flex. So here's the code that I had tried to do this with:

      <mx:DataGridColumn>
      <mx:itemRenderer>
      <mx:Component>
      <mx:HBox>
      <mx:Label htmlText="{data.comment}" />
      </mx:HBox>
      </mx:Component>
      </mx:itemRenderer>
      </mx:DataGridColumn>

      This works, but I lose the word wrapping for long comments (I have wordwrap="true" defined on my DataGrid).

      Then I tried changing my approach and doing something a little more simple to try and preserve the word wrapping, like this:

      <mx:DataGridColumn dataField="comment" width="100" wordWrap="true" fontWeight="{(data.viewed==0 ? 'bold' : 'normal')}" />

      Yet that doesn't seem to work either, it appears to just completely ignore everything... no bolding whatsoever.

      So my question is: what's the best to to control the BOLDING of a DataGrid cell while at the same time retaining the word wrap features?

      Thanks,
      Jacob