ItemRenderer listData value = null

Please see my itemRenderer below. Im having issues pulling
out the listData value so that I can reuse this itemRenderer across
my advanced dataGrid. The listData variable is coming out as null.
Then in the MXML Label instead of data.ATVIndex it should be
data[listData], is this correct?
Please help! I've been stuck on this for hours
<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:mx="
http://www.adobe.com/2006/mxml"
width="100%" height="100%">
<mx:Script>
<![CDATA[
import
mx.controls.advancedDataGridClasses.AdvancedDataGridListData
import mx.controls.dataGridClasses.DataGridListData;
import mx.controls.listClasses.BaseListData;
import mx.core.UIComponent;
import mx.controls.listClasses.IDropInListItemRenderer;
// Internal Variable for the property value
private var _listData:BaseListData;
// Make the listData property binaable
[Bindable("dataChange")]
// Define the getter method
public function get listData():BaseListData
return _listData;
// Define the setter method
public function set listData( value:BaseListData ):void
_listData = value;
public function addImage(score:Object):String
trace (listData);
if (score >1)
for(var __i:Number=0;__i<5;__i++){
var ui:UIComponent = new UIComponent();
if(__i < score){
ui.graphics.beginFill(0x74be21,1);
}else{
ui.graphics.beginFill(0xFFFFFF,1);
ui.graphics.lineStyle(1,0x000000,1);
ui.graphics.moveTo(__i*(7+2),6);
ui.graphics.lineTo(7+(__i*(7+2)),6);
ui.graphics.lineTo(7+(__i*(7+2)),13);
ui.graphics.lineTo(__i*(7+2),13);
ui.graphics.lineTo(__i*(7+2),6);
scoreBox.addChild(ui);
return score.toString();
else
for(var __i:Number=0;__i<5;__i++){
var ui:UIComponent = new UIComponent();
if(__i < score){
ui.graphics.beginFill(0xd14007,1);
}else{
ui.graphics.beginFill(0xFFFFFF,1);
ui.graphics.lineStyle(1,0x000000,1);
ui.graphics.moveTo(__i*(7+2),6);
ui.graphics.lineTo(7+(__i*(7+2)),6);
ui.graphics.lineTo(7+(__i*(7+2)),13);
ui.graphics.lineTo(__i*(7+2),13);
ui.graphics.lineTo(__i*(7+2),6);
scoreBox.addChild(ui);
return score.toString();
]]>
</mx:Script>
<mx:Label id="myLabel"
text="{addImage(data.ATVIndex)}"/>
<mx:HBox id="scoreBox" height="100%"
horizontalGap="0"/>
</mx:HBox>

"Nate Skiba" <[email protected]> wrote in message
news:gnm6qg$1up$[email protected]..
> addImage is getting called right away, before the
listData has been set.
> What you want to do is to do everything that you're
doing in addImage in
> updateDisplayList instead. Then have changing the data
or the listData
> invalidate the display list, and check to make sure that
they're both
> set before you execute the commands (since you seem to
be using both).
Also make sure you're telling Flex that it's allowed to set
listData on your
component.
<mx:HBox xmlns:mx="
http://www.adobe.com/2006/mxml"
width="100%"
height="100%" implements="IDropInListItemRenderer">
Note that you may need to use the fully qualified path
instead of just
IDropInListItemRenderer, but I'd rather you looked that info
up than me.

Similar Messages

  • SharePoint List Form using InfoPath 2010 "Cannot insert the value NULL into column 'tp_DocId', table 'Content_SP_00003.dbo.AllUserData'; column does not allow nulls"

    I am experiencing issue with my SharePoint site , when I am trying to add new Item in List . Error given below :--> 02/03/2015 08:23:36.13 w3wp.exe (0x2E04) 0x07E8 SharePoint Server Logging Correlation Data 9gc5 Verbose Thread change; resetting trace
    level override to 0; resetting correlation to e2e9cddc-cf35-4bf8-b4f3-021dc91642da c66c2c17-faaf-4ff9-a414-303aa4b4726b e2e9cddc-cf35-4bf8-b4f3-021dc91642da 02/03/2015 08:23:36.13 w3wp.exe (0x2E04) 0x07E8 Document Management Server Document Management 52od
    Medium MetadataNavigationContext Page_InitComplete: No XsltListViewWebPart was found on this page[/sites/00003/Lists/PM%20Project%20Status/NewForm.aspx?RootFolder=&IsDlg=1]. Hiding key filters and downgrading tree functionality to legacy ListViewWebPart(v3)
    level for this list. e2e9cddc-cf35-4bf8-b4f3-021dc91642da 02/03/2015 08:23:36.17 w3wp.exe (0x1B94) 0x1A0C SharePoint Server Logging Correlation Data 77a3 Verbose Starting correlation. b4d14aec-5bd4-4fb1-b1e3-589ba337b111 02/03/2015 08:23:36.17 w3wp.exe (0x1B94)
    0x1A0C SharePoint Server Logging Correlation Data 77a3 Verbose Ending correlation. b4d14aec-5bd4-4fb1-b1e3-589ba337b111 02/03/2015 08:23:36.31 w3wp.exe (0x2E04) 0x07E8 SharePoint Foundation Database 880i High System.Data.SqlClient.SqlException: Cannot insert
    the value NULL into column 'tp_DocId', table 'Content_SP_00003.dbo.AllUserData'; column does not allow nulls. INSERT fails. The statement has been terminated. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at
    System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject
    stateObj) at System.Data.SqlClient.SqlDataReader.ConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavi... e2e9cddc-cf35-4bf8-b4f3-021dc91642da 02/03/2015
    08:23:36.31* w3wp.exe (0x2E04) 0x07E8 SharePoint Foundation Database 880i High ...or runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream,
    Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior,
    RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior) at Microsoft.SharePoint.Utilities.SqlSession.ExecuteReader(SqlCommand
    command, CommandBehavior behavior,

    Are you trying to setup P2P? Could you explain the process you followed completely? By anychance you create the backup and then created the publication?
    Regards, Ashwin Menon My Blog - http:\\sqllearnings.com

  • Could not find selected item matching value "null" in CoreSelectOneRadio

    Hello,
    I get the following error with my selectOneChoice components:
    WARNING Could not find selected item matching value "null" in CoreSelectOneRadio[UIXEditableFacesBeanImpl, id=dyna_2709976_11]
    It seem that the component looks for a selectItem object qith its value set to null, so I tried to add one with a null value to no avail. The error don't cause any problem on the rendered page but it might spam the log when many users will be connected. Anyone every got this error and found a fix to stop it from appearing?
    Regards,
    Simon Lessard

    you said you're using selectOneChoice but the error says radio. Is the information correct?

  • Missing inverse index on remove: value=null

    When upgrading from Coherence 3.4 to 3.5 and during our test runs we see this in the log ..
    +12:56:39,241 INFO Coherence:3 - 2010-02-23 12:56:39.241 Oracle Coherence GE 3.5.3/465 <Info> (thread=dist-tradeobject-serviceWorker:1, member=17): Missing inverse index on remove: value=null, key=Binary(length=102, value=0x0DA20515AE0F00014E2C3130303232333A545955533A4275793A4571753A4D3A43534642444D413A5553443A5553443A435346423A30034E2C3130303232333A545955533A4275793A4571753A4D3A43534642444D413A5553443A5553443A435346423A3040)+
    above lines are repeated multiple times for multiple objects. Not sure what prompts this info message outcome..
    Can you please give me some pointers
    Thanks

    Hello,
    Sorry for the delay in responding. This does appear to be an issue which can be reproduced. There is an open issue number (COH-3055) assigned for tracking purposes. Thank you for reporting this problem.
    Dave

  • What does "Missing reverse index on remove: value=null" mean

    I am getting this error in my Coherence Debug Logs, what does this error mean ?
    Thanks
    14:46:24,923 WARN Coherence:3 - 2009-05-06 14:46:24.923 Oracle Coherence GE 3.4/405p1 <Warning> (thread=dist-customer-serviceWorker:1, member=25): Missing reverse index on remove: value=null,
    key=Binary(length=102, value=0x0DB53915AADDGFDF...etc

    I am still seeing this message (but as a info message) in 3.6.0.1. The test case is a single cache node and a single "client" that is inserting a lot of data. I have like 6 indexes defined (all using POF extractors). One index contains an array of a user type, the others primitive types. One index is sorted the rest not.
    Imho the condition causing this should be fixed or, if this is not causing any problems, performance or otherwise, the message be removed - pperation should be undisturbed by messages that has no meaning to the user!
    2010-08-19 08:42:57.718/50.860 Oracle Coherence GE 3.6.0.1 <Info> (thread=DistributedCache, member=1): Missing inverse index: value=ObjKey{typeId=0, instanceId=432}, key=Binary(length=17, value=0x0DB30315A33E000041BC010141A5CC0140)
    2010-08-19 08:42:57.718/50.860 Oracle Coherence GE 3.6.0.1 <Info> (thread=DistributedCache, member=1): Missing inverse index: value=ObjKey{typeId=0, instanceId=1117}, key=Binary(length=17, value=0x0DB40315A33E0000419B140141A4C40140)
    2010-08-19 08:42:57.718/50.860 Oracle Coherence GE 3.6.0.1 <Info> (thread=DistributedCache, member=1): Missing inverse index: value=ObjKey{typeId=0, instanceId=3194}, key=Binary(length=17, value=0x0DB50315A33E0000419D2E0141A7CC0140)
    2010-08-19 08:42:57.734/50.876 Oracle Coherence GE 3.6.0.1 <Info> (thread=DistributedCache, member=1): Missing inverse index: value=ObjKey{typeId=0, instanceId=542}, key=Binary(length=17, value=0x0DB90315A33E00004192450141BC900240)
    2010-08-19 08:42:57.734/50.876 Oracle Coherence GE 3.6.0.1 <Info> (thread=DistributedCache, member=1): Missing inverse index: value=ObjKey{typeId=0, instanceId=4042}, key=Binary(length=17, value=0x0DBB0315A33E000041940A01419C890340)
    2010-08-19 08:42:57.734/50.876 Oracle Coherence GE 3.6.0.1 <Info> (thread=DistributedCache, member=1): Missing inverse index: value=ObjKey{typeId=0, instanceId=4733}, key=Binary(length=17, value=0x0DBC0315A33E000041BC1D014191D90240)
    2010-08-19 08:42:57.734/50.876 Oracle Coherence GE 3.6.0.1 <Info> (thread=DistributedCache, member=1): Missing inverse index: value=ObjKey{typeId=0, instanceId=1632}, key=Binary(length=17, value=0x0DBE0315A33E000041B43E0141B1D00140)
    2010-08-19 08:42:57.749/50.891 Oracle Coherence GE 3.6.0.1 <Info> (thread=DistributedCache, member=1): Missing inverse index: value=ObjKey{typeId=0, instanceId=2490}, key=Binary(length=17, value=0x0D800415A33E00004196310141BEFC0140)
    /Magnus

  • String value null in the XI mapping

    Hi folks,
    is it possible to create in the XI mapping for a string the value <b>null</b> and not an empty string like "". It is necessarily for the Webservice over the soap adapter.
    Thanks for answers
    Johann

    Johann,
    Make sure the min. occurance of the target node is 0. If you do not map the field it will not throw an error. It will throw an error only if the min occurance is equal to or greater than 1.
    @Shabz,
    I guess Mapping to a string constant "null" is not the same as null. Pls correct me if I am wrong.
    Regards,
    Jai Shankr

  • Form values null.

    Hi,
    I am having a form field in my jsp page and on sumit I am passing the request to a servlet but in the servlet the form values are null even though i have entered the values in the field. Can any one please help me.
    I am posting my jsp and servlet.
    My jsp page <body>
    <body>
            <form action="LoginHandler" method="post" onsubmit="return ValidateForm(this)">
                <p><label> Login ID</label> <br />
                <input type="text" name="Username" size="10" /><br />
                </p>
                <p><label>Password</label> <br />
                <input type="password" name="Password" size="10" /></p>
                <p><input type="submit" value="Submit" class="textfont" /></p>
            </form>
        </body>
    My servlet
    import java.io.*;
    import java.net.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import communication.ServerComm;
    public class LoginHandler extends HttpServlet {
        ServerComm server;
        public void init(ServletConfig config) throws ServletException {
            super.init(config);
            server = new ServerComm();
          public void destroy() {
        protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            server.openConnection();
          //gets null value here
            String username = (String)request.getAttribute("Username");
            String password = (String)request.getAttribute("Password");
            /*other expressions*/
       protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            processRequest(request, response);
        protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            processRequest(request, response);
        public String getServletInfo() {
            return "Short description";
    }Thank you.

    You are calling request.getAttribute().
    You should be calling request.getParameter().
    Attributes vs Parameters
    A parameter is a name/value pair sent with a request - they are always Strings. They are read only - ie can only getParameter()
    An Attribute is a java object you want to save. Attributes can be at the page, request, session or application level. They can be any java object type. You have both get/set attribute calls.
    Cheers,
    evnafets

  • Value "null" is displayed when retrieving null values from database

    Hi,
    I'm retrieving a record from Oracle database using a ResultSet rs and displaying the values on screen. Some of the columns do not have any data.
    The statements are:
    ResultSet rs
    st=con.createStatement();
    rs=st.executeQuery(............)
    out.println("<input name='punch_line' type='text' value='"+rs.getString(7)+"'>");
    The problem is that there is no value in the database column rs.getString(7). Ideally when the value is null, the field should not display anything. But in my case it is displaying the text "null".
    Can anyone let me know how can I display a blank value instead of displaying the text "null"?
    Thanks,
    Sridhar

    api >
    String getString(int columnIndex)
    Gets the value of the designated column in
    column in the current row of this ResultSet object as
    a String in the Java programming language.
    so null is returned as string object..NO.
    http://java.sun.com/j2se/1.5.0/docs/api/java/sql/ResultSet.html
    Returns:
    the column value; if the value is SQL NULL, the value returned is null
    The Java literal null is returned, not the String "null". The JDBC API provides a method wasNull() to detect if the previous accessed column returned a SQL NULL.

  • How to see values (null, 0) instead of blank fields

    Hi.
    I search the forum but only found messages about users who want to show fields blank, when value is null.
    I have the problem other way around. I work with DevSuite 10g and have a xml-Report.
    I have fields and for some the query returns null (no value). Than the report shows nothing for this fields. Neither a blank line nor a value like 0.
    The problem is, that the other values afterwards the blank ones, slip above.
    For Example:
    field 1
    field 2
    field 3
    field 4
    The Query returns null for field 2 and 3.
    Then on the report I see:
    field 1
    field 4
    But what I want to see is:
    field 1
    field 4
    or:
    field 1
    0
    0
    field 4
    But all I tested doesn´t work. I set a value for "when null" in the attribute inspector and the horizontal elasticity of "fix" (I thought it maybe it "slip together" so it is not shown).
    Has anyone a idea how I can show a (blank or 0 value) instead of nothing, so that fields afterwards doesn´t slips up?
    Thanks for your suggestions
    Message was edited by:
    ulfk

    Hej MLA.
    I think it was from query, but it is anyway if it is from query or from form (it´s not from column).
    @Brad
    Thanks for your suggestion.
    We solve this problem in a similar way.
    We put a field under/over the other. We give the field we want to show a white background. So it is "sitting" over the other and the underlaying one is not shown (because the overlaying one has a white background).
    If the overlaying one is blank it is not shown (so it can´t has a white background) and we see the underlaying field.
    But to use triggers is a better solution.
    I solve it on the same way as explained above but using triggers also.
    But I have to leave a statement about Oracles Report Builder. Sorry but it is more than horrible program. I never have seen such a (also new and) bad programmed program. It is more than hard to work with it ... it cost me every hour I use it more and more power to stay quite ...
    Here are the things I really wish to change at reports bulder directly:
    - more than one step back (undo)
    - there is a difference between the output in reports bulder on the paper output, what is shown when you print it on a paper (from reports bulder) and from what is shown in a PDF file produced with a reports server (that is really annoying, you never now if it is correct what you see in reports builder!)
    - better editing and better selectable of the text-boxes and fields
    - a way to hierarchically objects that are on the same layer (frame) so that you can really bank on it, that one object is ever behind another one
    - not only moving and scaling of fields and boxes on a fix gutter (free transforming and moving would be great) because sometimes a text or a box with line around is not on the right place (out of order; above another object/text a.s.o.) and when it is (why I don´t really know) is not on the right place and the distance to the other object is less than the fix gutter-distance you can´t move it in such a way, that the two objects are flush with/on a fix line/place. It´s because the fix gutter. The distance is lower than the gutter, if you move it, it is not makeable to move it this less-than-the-gutter-distance to be flush with the other object. You can only move it in the fix gutter-distance and than it can´t be flush with the other objects.
    It looked really bad and amateurish!
    - a tool (a button or something) where you can marked object to flush all together on the same line, so that all objects for example are flush together on one start-line or ends (horizontal or vertical flush).
    It would be great and would the work so really easier and better.

  • Datagrid itemRenderer dynamic values

    While working on an application I came across the following
    problem. I've got a view with a datagrid, where I have several
    columns. Each column needs 2 values displayed beneath each other in
    one cell. You make an itemRenderer with 2 labels inside a VBox.
    Easy so far. However since this scenario repeats several times it
    seems counterproductive to make an itemRenderer for each cell. How
    can I make the text property for the labels change for each cell
    instead of being static in their values.
    Thx in advance.

    Your description of your requirements and your sample code do
    not paint a clear enough picture.
    Your dataProvider has 4 pieces of data: batchId,
    bookingNumber, valueDate, immsBranch. Your current itemRenderer
    references two of those pieces of data, and you say you want to
    reference the other two. You can do that easily like this:
    <mx:Label text="data.valueDate"/>
    <mx:Label text="data.immsBranch"/>
    A basic question: will your DataGrid have two rows for each
    set of 4 pieces of data? If so then I understand your problem. If
    not, then you must clarify exactly how and when you would like the
    4 pieces of data shown in your DataGrid.
    In any case, you probably need a Repeater, and then need to
    figure out how to get at the right data at the right time in the
    Repeater.
    See this FB 3 help topic and its sub-topics:
    Dynamically Repeating Controls and Containers
    Also search for this in the FB3 help to see the API:
    mx.core.Repeater
    You can define a listener for the Repeater for the Repeat
    event to specify processing for each iteration of the
    repeater.

  • 0requid with value null

    Hi Guys,
    I have raise a doubt about null values in the 0requid.  Currently, i have a cube that have been load, rollup and collapsed till a specif date and afterward only rollup have been done. In adition, the loads are deltas from an ods to this cube.
    My doubt is how can affect this null values of the 0requid to my delta loads? How can affect rollup/collapsed processes to the delta load, because there are a mix between null 0requid and normal values in this field?
    Thanks in advance for your collaboration.
    Best Regards,
    Jeysi Ascanio

    Stephan Staeheli wrote:
    Hello
    I'm using CMP EntityBean with WLS81 and Oracle DB. Now I have a finder method with two fields in the where clause. One of these two field can be null. But this isn't working. It seems like WLS is doing the following "....WHERE field1 = 'xxx' AND field2 = null". This isn't working in Oracle, it has to be like that: ".... AND field2 is null".
    Could anybody confirm this behaviour and maybe tell me if this is a bug or not.
    Regards,
    StephanIt's standard SQL semantics. Null is defined as 'uncomparable' to other values, so
    where XYZ = null will never be true. That's why they have 'is null'.
    Joe

  • How to declare value null to object at the end of jsp page.

    Hi
    I have two doubts.
    1. Im getting request from request.getParameter() method. i stored that value in one object. after process completion i have set null value to object at the end of jsp page.
    2. I declare jsp scriptlet within the javascript. in that jsp scriptlet i set session.setAttribute() values. i want to get the session.getAttribute value after javascript code completion.
    i tried but i got jasperException.
    please help me to solve this problem
    Thank u in advance

    Hai Sundaram,
    when ever u got the param from request at that time only u set the same parameter to null..
    i am not sure abt this is my idea only

  • Importing a spreadsheet with value NULL

    I have exported a query from a database into Excel and some of the values are NULL.
    I am attempting to import this spreadsheet into SQL Server using SSIS 2012 (Data Tools).  I have created a package that includes a source and a destination.  In the source I select all of the fields.  One of the rows contains a list of dates
    and some NULL values.  When I create a table I set this field's datatype to datetime, but when I attempt to carry out the import I receive an error message because the NULL value is in fact a text and not a blank value.
    As a (not so) quick fix I have deleted all of the NULL values so that they are blank.  This will import the data into the datetime field in my newly created table.  Is there any way I can amend the package so that it will set NULL values into the
    spreadsheet to a null in the database table.

    Use the Derived Column Transformation in which set the incoming NULL to DBNULL
    e.g isnull(column)?dbnull(dt_date):column
    Arthur My Blog

  • Custom itemRenderer component based on cell value: error 1009

    I'm working on an item renderer for a dataGrid that has different states depending on the cell and row values.
    The cell value is a toggle (true or null), and sets whether content should be shown in the cell or not
    The row properties determine what is shown when the cell value is true.
    The dataGrid dataProvider is populated based on user id input.
    I created the itemRenderer as a custom actionscript component, closely following this example:
    360Flex Sample: Implementing IDropInListItemRenderer to create a reusable itemRenderer
    However, my component results in Error #1009 (Cannot access a property or method of a null object reference) when a user id is submitted.
    package components
         import mx.containers.VBox;
         import mx.controls.*;     import mx.controls.dataGridClasses.DataGridListData;
         import mx.controls.listClasses.BaseListData;
         import mx.core.*;
         public class toggleCellRenderer extends VBox
              public function ToggleCellRenderer()
              {super();}
              private var _listData:BaseListData;   
                   private var cellState:String;
                   private var cellIcon:Image;
                   private var imagePath:String;
                   private var imageHeight:int;
                   private var qty:String = data.qtyPerTime;
                   private var typ:String = data.type;
              public function get listData():BaseListData
                   {return _listData;}
              public function set listData(value:BaseListData):void
                   {_listData = value;}
              override public function set data(value:Object):void {
                   super.data = value;
                   if (value != null)
                   //errors on next line: Error #1009: Cannot access a property or method of a null object reference.
                   {cellState = value[DataGridListData(_listData).dataField]}
              override protected function createChildren():void {
                   removeAllChildren();
                   if(cellState=='true'){
                        cellIcon = new Image();
                        addChild(cellIcon);
                   //there is another state here that adds another child...
              //next overrides commitProperties()...
    There are no errors if I don't use an itemRenderer--the cells correctly toggle between "true" and empty when clicked.
    I also tried a simple itemRenderer component that disregards the cell value and shows in image based off row data--this works fine without errors or crashing. But I need to tie it to the cell value!
    I have very limited experience programming, in Flex or any other language. Any help would be appreciated.

    Your assumption that the xml file either loads with "true" or nothing  is right.
    After modifying the code to the following, I don't get the error, but it's still not reading the cell value correctly.
    package components
         import mx.containers.VBox;
         import mx.controls.*;   
         import mx.controls.dataGridClasses.DataGridListData;
         import mx.controls.listClasses.BaseListData;
         import mx.core.*;
         public class toggleCellRenderer extends VBox
              public function ToggleCellRenderer()
               super();
              private var _listData:BaseListData;   
              private var cellState:Boolean;
              private var cellIcon:Image;
              private var imagePath:String;
              private var imageHeight:int;
              private var qty:String;
              private var typ:String;
               public function get listData():BaseListData
                 return _listData;
              override public function set data(value:Object):void {
                   cellState = false;
                   if (listData && listData is DataGridListData && DataGridListData(listData).dataField != null){
                       super.data = value;
                       if (value[DataGridListData(this.listData).dataField] == "true"){
                           cellState = true;
              override protected function createChildren():void {
                   removeAllChildren();
                   if(cellState==true){
                        cellIcon = new Image();
                        addChild(cellIcon);
                   //there is another state here that adds another child...
              //next overrides commitProperties()...
    - didn't set the value of qty or typ in the variable declarations (error 1009 by this too--I removed this before but wanted to point out in case its useful)
    - added back in the get listData() function so I could use the listData
    - changed the null check
    All cells are still returning cellState = false when some are set to true, even if I comment out [if (value[DataGridListData(this.listData).dataField] == "true")] and just have it look for non-null data. That shouldn't make a difference anyway, but it confirms that all cells are returning null value.
    Swapping out the first if statement in set data with different variables results in the following:
    [if (listData != null)]  all cells return null (cellState=false for all)
    both [if (value != null)] and  [if (DataGridListData != null)]  results in error 1009 on a line following the if, so I assume they return non-null values.
    All rows have data, just not all fields in all rows, so shouldn't listData be non-null?  Could it be that the xml file hasn't fully loaded before the itemRenderer kicks in?
    I also realized  I had removed the item renderer from many of the columns for testing, and since some columns are hidden by default only one column in the view was using the itemRenderer--hence the single alert per row I was worried about earlier.
    Thanks for your help so far.

  • How do I access listData for a DataGrid itemRenderer?

    I want to make simple reusable components in .mxml to use in
    my dataGrid classes. I do NOT want to specify the data field
    because I might use the same renderer in multiple columns of the
    same Grid (for example a check box renderer) and I do not want to
    make several identical components whose only difference is the
    value they draw from "data". To do this, I need access to
    "listData". Specifically listData.dataField. According to the docs
    I need to implement mx.controls.listClasses.IDropInListRenderer. I
    have tried the following in my mxml code:
    <mx:Component id="reusableEditor">
    <mx:HBox
    implements="mx.controls.dataGridClasses.DataGridItemRenderer">
    import mx.controls.dataGridClasses
    .. contents and logic for displaying
    data[listData.dataField]..
    </mx:HBox>
    </mx:Component>
    I get an unhelpful error in Flex Builder saying that "An
    internal build error has occurred" and only now guess that it comes
    from the line
    "implements="mx.controls.dataGridClasses.DataGridItemRenderer""
    (when I remove that line, things work fine). I have not found
    anywhere to check if I am implementing this correctly because there
    is no example to work from that does what I want to do--even though
    I use DataGrid 100s of times more often than any other list class!
    The TreeRenderer example later in the docs is the only code
    addressing this issue but it involves an AS Class that does not
    extend (as far as I can tell) a Container like HBox and implements
    no interface.
    To put the question simply, how can I get access to
    listData???

    the <mx:DataGridItemRenderer> tag was not the solution
    either...
    I finally figured out what the ambiguous compiler error
    meant... I hadn't implemented the functions required for the
    interface. Below is working code that either declared as an
    internal component or an external .mxml file will display the value
    of its column without explicitely defining what that value is.
    Although this component is extremely simple, it was very
    difficult to figure out how to implement from the docs... I hope
    someone from Adobe takes note.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute">
    <mx:Script>
    <![CDATA[
    [Bindable]
    public var dp:Array = [{num:2, bool:true}, {num:3,
    bool:false}];
    ]]>
    </mx:Script>
    <!-- BrainlesslySimpleCheckBoxRenderer class -->
    <mx:Component id="cbren3">
    <mx:HBox horizontalAlign="center" verticalAlign="middle"
    implements="mx.managers.IFocusManagerComponent,
    mx.controls.listClasses.IDropInListItemRenderer">
    <mx:Script>
    <![CDATA[
    import mx.controls.listClasses.BaseListData;
    import mx.controls.dataGridClasses.DataGridListData;
    private var _listData:DataGridListData;
    [Bindable("dataChange")]
    public function get listData():BaseListData {
    return _listData;
    public function set listData(value:BaseListData):void {
    _listData = DataGridListData(value);
    override public function drawFocus(focused:Boolean):void {
    check.setFocus();
    override protected function
    updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
    super.updateDisplayList(unscaledWidth, unscaledHeight);
    if (super.data) {
    var dgListData:DataGridListData =
    DataGridListData(listData);
    //for some reason, setting check.selected here results in
    buggy behavior
    //check.selected = data[dgListData.dataField];
    //defining a getter based on the "dataChange" event seems to
    update the CheckBox value properly when
    //clicked, rolledOut, sorted, etc...
    //also, doing it this way circumvents those annoying "Data
    binding will not be able to detect changes... blah blah"
    [Bindable("dataChange")]
    public function get val():Boolean {
    return Boolean(data[_listData.dataField]);
    ]]>
    </mx:Script>
    <mx:Boolean id="blorch" />
    <mx:CheckBox id="check" selected="{val}"
    change="blorch=check.selected"
    updateComplete="blorch=check.selected" />
    </mx:HBox>
    </mx:Component>
    <mx:DataGrid id="test" editable="true"
    dataProvider="{dp}">
    <mx:columns>
    <mx:DataGridColumn dataField="num" headerText="num" />
    <mx:DataGridColumn dataField="bool" headerText="Sent"
    itemRenderer="{cbren3}" rendererIsEditor="true"
    editorDataField="blorch">
    </mx:DataGridColumn>
    <mx:DataGridColumn dataField="num" headerText="num"
    editable="true" />
    </mx:columns>
    </mx:DataGrid>
    </mx:Application>
    if anyone has suggestions or feedback, please let me know...
    I am still trying to figure out the best way to do this.

Maybe you are looking for