Solved

Flex - Item Renderer in ADG

Posted on 2011-02-28
5
699 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
[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
  • 3
  • 2
5 Comments
 
LVL 1

Author Comment

by:CubicleGuy
ID: 35003143
I'm referring to the Note column.....
0
 
LVL 20

Expert Comment

by:ChristoferDutz
ID: 35005908
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
ID: 35007398
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
ID: 35007469
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
ID: 35008099
This is why I pay my dues.....
0

Featured Post

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure (http://www.axure.com/). It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

752 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