Solved

Flex - Item Renderer in ADG

Posted on 2011-02-28
5
700 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

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

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

Turn A Profile Picture Into A Cartoon Using Photoshop And Illustrator This tutorial will teach you how to make a cartoon style image out of a regular picture. I have tried to keep the tutorial as simple as possible. I used Adobe CS4 for this tuto…
Objective of This Article In 1990’s, when I was a budding software professional, I had a lot of confusion about which stream or technology, I had to choose to build my career. In those days, I had lot of confusion like whether to choose System so…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

615 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