3 Replies Latest reply on Sep 12, 2008 11:36 AM by Gregory Lafrance

    Underline text in datagrid

    wkolcz Level 1
      I am using a datagrid to show an RSS feed on a static web site. The datagrid, by nature, highlights the row as you mouse over it. To blend in with the other sections of the html page, the client has requested that the text be underlined as you mouse over instead. Can anyone point me in the direction of accomplishing this?
        • 1. Re: Underline text in datagrid
          Vanden_B
          If you have a loop to fill the datagrid, make an if-statement for which data you would have an underlined text.
          Within this if-statement make a ClassFactory variabele:
          var egRenderer : ClassFactory = new ClassFactory(EgRenderer);

          add this variabele to you datagrid:
          dg.itemRenderer = egRenderer;

          Make the EgRenderer. In here you can make a LinkButton with some textDecoration="underline" or so. You can style and do in here what you like.
          • 2. Re: Underline text in datagrid
            cj_c
            Or try this...

            define a couple styles in a style block or style sheet. one with textDecoration: none; the other with textDecoration: underline;

            <mx:DataGridColumn headerText="Task" visible="true" textAlign="left" width="280" showDataTips="true">
            <mx:itemRenderer>
            <mx:Component>
            <mx:Label text="{data.Name}" color="#68828F"
            styleName="lblNoUnderline"
            mouseOver="styleName='lblUnderline'"
            mouseOut="styleName='lblNoUnderline'"/>
            </mx:Component>
            </mx:itemRenderer>

            define an itemClick custom event for the DataGrid and in the custom event function do something like this...

            /* process the click event on the datagrid only continue when 1st column is clicked*/
            if(event.columnIndex!=0){return;}

            //additional process here...

            Hope this helps.
            cj
            • 3. Re: Underline text in datagrid
              Gregory Lafrance Level 6
              This code undelines the text and creates a link as well.