Select the last row in a Grid : Grid « Container « Flex

Home
Flex
1.Chart
2.Components
3.Container
4.Data Model
5.Development
6.Effects
7.Event
8.Graphics
9.Grid
10.Style
Flex » Container » GridScreenshots 
Select the last row in a Grid
Select the last row in a Grid
          

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
  <mx:Script>
    
      import mx.collections.ArrayCollection;
          
      [Bindableprivate var gridArrayCollection:ArrayCollection = new ArrayCollection();

      private function addGridItem(event:Event):void 
      {
        gridArrayCollection.addItem(NameInput.text);
        callLater(selectNewRow);
      }
        
      private function selectNewRow():void 
      {
        nameGrid.selectedIndex = nameGrid.rowCount;
      }
        
  
  </mx:Script>
    <mx:VBox width="100%" height="100%">
        <mx:DataGrid id="nameGrid" dataProvider="{gridArrayCollection}" width="100%" height="100%">
          <mx:columns>
            <mx:DataGridColumn dataField="firstName" headerText="First Name"/>
          </mx:columns>
        </mx:DataGrid>
        <mx:Label text="Name:" />
        <mx:TextInput id="NameInput" />
        <mx:Button label="Enter New Item" click="addGridItem(event)"/>
  </mx:VBox>
</mx:Application>

   
    
    
    
    
    
    
    
    
    
  
Related examples in the same category
1.Fill GridItem with ButtonFill GridItem with Button
2.Include five buttons across the top rowInclude five buttons across the top row
3.Grid Row SpanGrid Row Span
4.Use Grid to layout controlsUse Grid to layout controls
5.Grid with column span and row spanGrid with column span and row span
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.