Datagrid item renderer delete button

flex

    Next

  • 1. Scheduling Framework question
    Using the Flex scheduling framework, how do draw a verticle line at the current time. Basically, using demo example 6, and clicking it's "now" button, i'd like to draw this line when I press the "now" button ... subsequent clicking of the button should redraw the verticle line at the current time again. Any help greatly appriciated. A
  • 2. HELP! Tilelist effects not working when dataprovider is filtered
    Hi All, I have a tile list displaying thumbnail images which is bound to an array collection. I have a nice little DefaultTileListEffect on the tile list to fade things in and out when changes are made to the array collection. I notice that when I filter the array collection using its filterFunction that the effect does not run on items that get filtered out or in... any ideas on how to get this to work? It would be quite nice to have the images fade out as they no longer meet the filter requirements and fade back in when they do. Cheers, Brendon
  • 3. Get the Coordinates of a Character in a TextArea
    Is there a way to determine what the coordinates of a given character are in a TextArea control? One project I'm working on presents a chunk of text cut off at some number of characters, followed by a LinkButton control (e.g., to view "more"), and I'm having trouble figuring where to place the LinkButton control without knowing the coordinates of the last visible character of the TextArea. Anyone dealt with this one before? Thanks in advance... Chris
  • 4. RollOver firing continously?
    You are prob creating a new item over the grid and under the mouse. It triggers the "out" event, goes away and the mouse is once again over the grid... so it fires again. Maybe anyway...

Datagrid item renderer delete button

Postby nrutter » Fri, 16 May 2008 23:31:22 GMT

I have a datagrid with an item renderer.  In the item renderer is a delete 
button img.  Onclick it will remove the item from the datagrid with the 
exception of the first item.  I am using outer document to call my function but 
when I do I get an error that says Attempt access of inaccessible method 
deleteContact through a reference with static type myTitleWindowContact?

 private function deleteContact(event:Event,data:*):void{
 	if (contactData.selectedIndex >= 1) {
 	caseVO.acCont.removeItemAt(contactData.selectedIndex);
 	 }
  }

 <mx:DataGrid dataProvider="{model.currentVO.acCont}" 
 	id="contactData" 
 	width="651" 
 	height="117" 
 	click="showForm()" >
 		<mx:columns>
 		 <mx:DataGridColumn editable="false" width="5">
 		        	<mx:itemRenderer>
 		        		<mx:Component>
 		        			<mx:HBox width="100%" height="15" horizontalAlign="center" 
verticalAlign="middle">
 		        				<mx:Button 
 		        
					icon="@Embed(source='/com/serg/reportingTool/assets/images/delete.png')"
 		        					click="outerDocument.deleteContact(event,data)" 
 		        					label="D" 
 		        					toolTip="Delete" 
 		        					width="15"
 		        					height="15"
 		        					/>
 		        			</mx:HBox>
 		        		</mx:Component>
 		        	</mx:itemRenderer>
 		        </mx:DataGridColumn>


Re: Datagrid item renderer delete button

Postby Greg Lafrance » Sat, 17 May 2008 01:38:27 GMT

Make your function public.

 <?xml version="1.0"?>
 <mx:Application xmlns:mx=" http://www.**--****.com/ ">    
     <mx:Script>
         <![CDATA[
             import mx.collections.ArrayCollection;
         
             [Bindable]                        
             private var initDG:ArrayCollection = new ArrayCollection([
                 { Header:'Test Header'}
             ]);
             
 			public function printString():String{
 				return "I'm inside the renderer!!!";
 			}            
         ]]>
     </mx:Script>
     <mx:DataGrid id="myGrid" dataProvider="{initDG}" width="100%" 
variableRowHeight="true">   
         <mx:columns>
             <mx:DataGridColumn dataField="Header">
                 <mx:itemRenderer>
                   <mx:Component>
                     <mx:VBox>
                          <mx:TextArea 
                            text="{outerDocument.printString()}"/>
                     </mx:VBox>
                   </mx:Component>
                 </mx:itemRenderer>
             </mx:DataGridColumn>    
         </mx:columns>       
     </mx:DataGrid>      
 </mx:Application>


Similar Threads:

1.Datagrid item renderer delete button

That fixed that issue Thanks so much!  One other question though.  Is it possible to have my delete button appear on all items in the datagrid except for the first item??

2.DataGrid Horizontal Scroll Problem when datagrid contains Item renderer



Return to flex

 

Who is online

Users browsing this forum: No registered users and 69 guest