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
Solved

Flex - Item Renderer in ADG

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

In this short web based tutorial, I wanted to show users how they can still use the powers of FrontPage in conjunction with Expression Web 3.  Even though Microsoft eliminated the use of Web components, we can still use them with FrontPage and edit …
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…
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

839 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