Solved

Flex - Item Renderer in ADG

Posted on 2011-02-28
5
691 Views
Last Modified: 2012-08-14
I want to have a button on each row of a data grid that is ENABLED only if the length of the data in the note column is greater than 0, or is not nulll, which ever works.  I've futzed with this all afternoon and have not come up with the best solution.  

Thanks



            <mx:AdvancedDataGrid id="dgiiM"  dataProvider="{orders}" visible="true" fontSize="12" rowCount="20" paddingLeft="10" editable="true"
                  borderStyle="outset" dropShadowEnabled="true" shadowDistance="5" dropShadowColor="#000000" width="98%" themeColor="#FF9C01">
                  <mx:columns>
                        <mx:AdvancedDataGridColumn dataField = "Supplier" headerText="Supplier" styleFunction="colorDescription" fontSize="11" width="100" editable="false"/>
                        <mx:AdvancedDataGridColumn dataField = "Tier" headerText="T" fontSize="11" editable="false" width="25"/>
                        <mx:AdvancedDataGridColumn headerText="Note" editable="false">
                              <mx:itemRenderer>
                                    <mx:Component>
                                          <mx:Button label="Note" enabled="{outerDocument.data.Note.length >0}"/>
                                    </mx:Component>
                              </mx:itemRenderer>
                        </mx:AdvancedDataGridColumn>
                        <mx:AdvancedDataGridColumn dataField = "PO_Number" headerText="PO" fontSize="11" editable="false" width="75"/>                              
                        <mx:AdvancedDataGridColumn dataField = "PODate" headerText="PO Date" labelFunction="formatPODate" fontSize="11" editable="false"/>
                        <mx:AdvancedDataGridColumn dataField = "Item" headerText="Item"  fontSize="11" editable="false"/>  
                        <mx:AdvancedDataGridColumn dataField = "QtyOrd" headerText="QtyOrd" fontWeight="bold" fontSize="11" textAlign="right"/>
                        <mx:AdvancedDataGridColumn dataField = "QtyShip" headerText="QtyShip" fontWeight="bold" fontSize="11" textAlign="right"/>                        
                        <mx:AdvancedDataGridColumn dataField = "toShipDate" headerText="SchShipDate" sortable="true" labelFunction="formatShipDate" fontSize="11" editable="false"/>
                        <mx:AdvancedDataGridColumn dataField = "actualShipDate" headerText="ActShipDate" sortable="true" labelFunction="formatactualShipDate" fontSize="11" editable="false"/>                        
                        <mx:AdvancedDataGridColumn dataField = "mode" headerText="Mode" sortable="false" fontSize="11"/>
                        <mx:AdvancedDataGridColumn dataField = "containerNumber" headerText="Track" sortable="false" fontSize="11"/>
                        <mx:AdvancedDataGridColumn dataField = "portEDA" headerText="PortEDA" sortable="true" labelFunction="formatportEDA" fontSize="11" editable="false"/>
                        <mx:AdvancedDataGridColumn dataField = "actPortEDA" headerText="ActPortEDA" sortable="true" labelFunction="formatactPortEDA" fontSize="11" editable="false"/>
                        <mx:AdvancedDataGridColumn dataField = "destination" headerText="Destination" sortable="true"  fontSize="11" editable="false"/>                                   
                        <mx:AdvancedDataGridColumn dataField = "recDate" headerText="RecDate" labelFunction="formatShipDate" fontSize="11" editable="false"/>
                        <mx:AdvancedDataGridColumn dataField = "QtyRec" headerText="QtyReceived" sortable="false"  fontSize="11"  fontWeight="bold" textAlign="right" editable="false"/>
                        <mx:AdvancedDataGridColumn dataField = "QtyOpen" headerText="QtyOpen" sortable="false"  fontSize="11" fontWeight="bold" textAlign="right" editable="false"/>
                  </mx:columns>
            </mx:AdvancedDataGrid>
0
Comment
Question by:CubicleGuy
  • 3
  • 2
5 Comments
 
LVL 1

Author Comment

by:CubicleGuy
Comment Utility
I'm referring to the Note column.....
0
 
LVL 20

Expert Comment

by:ChristoferDutz
Comment Utility
Is the "Note" property a property of the datagrid row? If yes, then yuo shouldn't write
{outerDocument.data.Note.length >0}

Open in new window

but
{data.Note.length > 0}

Open in new window

Because the renderer usually has a "data" property, that relates to the current row-element.
0
 
LVL 1

Author Comment

by:CubicleGuy
Comment Utility
Note is the name of the data in that column which is part of the dataprovider, but not displayed in the grid itself.  I'll try this and get right back to you.

Thanks
0
 
LVL 20

Accepted Solution

by:
ChristoferDutz earned 250 total points
Comment Utility
Ok ... if this is the case, the expression "data.Note.length" should work, but if Note can be null, I would rather suggest to use the following:
(data.Note &amp;&amp; (data.Note.lenght > 0))

Open in new window


You have to write "& a m p ;" (i added a space between every char to prevent EE from excaping the text automatically) instead of "&" if you use the ampersand char in the xml-section.
0
 
LVL 1

Author Closing Comment

by:CubicleGuy
Comment Utility
This is why I pay my dues.....
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
The purpose of this video is to demonstrate how to integrate Mailchimp with Facebook. This will be demonstrated using a Windows 8 PC. Mailchimp and Facebook will be used. Log into your Mailchimp account. : Click on your name. Go to Account Setti…
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now