?
Solved

Flex ItemRenderer in grid no longer uses datagrid styling.

Posted on 2010-09-20
2
Medium Priority
?
558 Views
Last Modified: 2013-11-11
I have a datagrid with a column that uses an ItemRenderer (Text component since it is multi-lined) to set the font style to italics when the column contains a certain value.  This works fine.  My problem is that the column no longer displays the css styles set for the datagrid.  The rollover color is working, but the textRollOverColor and textSelectedColor are no longer working.  How do I get my Text ItemRenderer to maintain the datagrid styles?  Thanks.
0
Comment
Question by:trudyhlittle
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 11

Accepted Solution

by:
petiex earned 1000 total points
ID: 33726467
I think the problem is that the mx.controls.Text component does not have a textRollOverColor or textSelectedColor style.

To simulate the textRollOverColor style in the renderer, you could add event listeners to the mouseOver and mouseOut events to change the Text control's style["color"] to the roll-over color and back to the default color, respectively. Then for the textSelectedColor, you could change the text color on the focusIn and focusOut events of the dataGridColumn.

OR, I think you could just extend the default DataGridItemRenderer, override the set data function to conditionally set the style to italic using something like the attached code, and then, to allow for multi-line text, just set variableRowHeight="true" on the DataGrid, and set wordWrap="true" on the DataGridColumn.
package testflex {
import mx.controls.dataGridClasses.DataGridItemRenderer;

public class TestRenderer extends DataGridItemRenderer {
    public function TestRenderer() {
        super();
    }
    public override function set data(data:Object):void{
        if(data["clam"]=="try"){// set the field value where you want to italicize
            setStyle("fontStyle", "italic");
        }
        super.data = data;
    }
}
}

Open in new window

0
 

Author Closing Comment

by:trudyhlittle
ID: 33726922
Thanks a bunch.  I tried using the MouseOver and MouseOut events originally.  This worked if the user was actually over the data column itself, however, if they were hovering over another column when the were selected a row, the rollovers weren't displayed.  Extending the DataGridItemRenderer worked and with a lot less coding.  Thanks.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
Suggested Courses
Course of the Month14 days, 14 hours left to enroll

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question