Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Flex - Item Renderer in ADG

Posted on 2011-02-28
5
Medium Priority
?
707 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
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 1000 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
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 the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

877 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