De-selection in a DataGrid

I use a DataGrid in a popup window. When it is shown in the first-time, no rows are selected. A row gets selected when using the data grid. Then the
Popup DataGrid will be closed.
When I open the popup window again, the previous selection is still there. How do I initialize the DataGrid so it has no row selected?

Hi there,
When you are about to call the pop up window with the datagrid, set the selectedIndex property to -1 (yourDataGrid.selectedIndex=-1). This shall make sure that no rows are selected in your datagrid. Let me know if that works for you.
Cheers!
Deepak

Similar Messages

  • Enable multiple selection in spark datagrid

    Hi guys, I am trying to enable multiple selection in my datagrid. I tried allowMultipleSelection=true but it didn't have that attribute on spark component. Anyone knows how to do it? Thanks a lot.

    Use selectionMode="mutipleRows"
    http://help.adobe.com/en_US/flex/using/WS0ab2a460655f2dc3-427f401412c60d04dca-7ff8.html

  • How to delete a selected row from datagrid and how to create a datagrid popup

    hi friends,
                  I am new to flex.i am doing a flex4 application,i need help for this.
                i am having a data grid with columns.i have two questions.
               Ques 1: when  i selected a partiuclar row from a datagrid and click delete button  means that record will delete from the datagrid and DTO from the cloud  tables also.
                Ques 2: when i save  the data grid values using save button means that data will store in  respective cloud DTO which is related to the datagrid,
                     My requirement is i am using a search button when i click the search  button it will show a datagrid that datagrid will contain the previous  datagrid datas which is saved in the cloud.
    REQUIREMENT example: first screen:           i am using with data grid 3 columns (Student Roll number ,Student Name,Student pecentage)---->save--->data will store in cloud DTO.
    Second screen:                search button ----> it need show  datagrid popup.it will have data which we saved in the first screen with same columns(Student Roll number ,Student Name,Student pecentage).
    This is my requirement.
    Any suggession welcome.
    Thanks in advance.
    B.Venkatesan

    Lets break the problem statement in multiple steps
    1. We need a way to know the selection on all rows.
    2. We need the association of the checkBox with the data
    The  solution is to use a arrayCollection/array that holds all the instances  created for checkbox.This collection should be a property of component  containing the datagrid. We need to use a custom component  implementation or inline ItemRenderer. The way you have used is called  dropinItemRenderer. Preferaly use custom component implementation and  add the instance to the arrayCollection at CreationComplete. Make sure  you use addItemAt so that you add the instance in the same row as the  data. To get rowIndex the custom Checkbox should implement  IDropInListItemRenderer. You could iterate this collection to check all  the instances that are checked.
    Note: This is the approach considering your dataprovider doesnt have a selection field.
    Nishant

  • How to delete a Selected row from datagrid and how to create a datagrid popup with saved values

    hi friends,
                  I am new to flex.i am doing a flex4 application,i need help for this.
                i am having a data grid with columns.i have two questions.
               Ques 1: when i selected a partiuclar row from a datagrid and click delete button means that record will delete from the datagrid and DTO from the cloud tables also.
                Ques 2: when i save the data grid values using save button means that data will store in respective cloud DTO which is related to the datagrid,
                    My requirement is i am using a search button when i click the search button it will show a datagrid that datagrid will contain the previous datagrid datas which is saved in the cloud.
    REQUIREMENT example: first screen: i am using with data grid 3 columns (Student Roll number ,Student Name,Student pecentage)---->save--->data will store in cloud DTO.
    Second screen: search button ----> it need show  datagrid popup.it will have data which we saved in the first screen with same columns(Student Roll number ,Student Name,Student pecentage).
    This is my requirement.
    Any suggession welcome.
    Thanks in advance.
    B.Venkatesan

    Lets break the problem statement in multiple steps
    1. We need a way to know the selection on all rows.
    2. We need the association of the checkBox with the data
    The  solution is to use a arrayCollection/array that holds all the instances  created for checkbox.This collection should be a property of component  containing the datagrid. We need to use a custom component  implementation or inline ItemRenderer. The way you have used is called  dropinItemRenderer. Preferaly use custom component implementation and  add the instance to the arrayCollection at CreationComplete. Make sure  you use addItemAt so that you add the instance in the same row as the  data. To get rowIndex the custom Checkbox should implement  IDropInListItemRenderer. You could iterate this collection to check all  the instances that are checked.
    Note: This is the approach considering your dataprovider doesnt have a selection field.
    Nishant

  • Disable selection color in datagrid/list/tilelist?

    I have a datagrid and would like to disable the selection
    color. I disable the rollover color by using useRollOver to
    false.

    MXML
    <mx:DataGrid id="dg"
    selectionColor="dg.getStyle('backgroundColor')"/>
    AS
    dg.setStyle("selectionColor",
    dg.getStyle("backgroundColor"));

  • Lost selection in the DataGrid after dispatchEvent

    Hi I have two data list(DataGrid ) in the one page, left one list information, and right one list selected information's properies.
    When I select one of information in the left, which retrieve its properties from server(Java Jetty), code like this:
    <mx:DataGrid id="dgStores" dataProvider="{storesList}"
    change="dispatchEvent(new TideUIEvent('displayProp',dgStores.selectedItem));"
    width="100%" rowCount="8">
    <mx:columns>
    </mx:columns>
    </mx:DataGrid>
    <mx:DataGrid  dataProvider="{storesPropList}"  visible="{Boolean(dgStores.selectedItem)}" >
            <mx:columns>
            </mx:columns>
    </mx:DataGrid>
    dispatchEvent is to try to get storesPropList data
    Can someone figure out what cause left DataGrid lost focus (unselected)?
    Thanks

    See what CollectionEvents are being dispatched from the left list's dataprovider.  If you see an event with CollectionEventKind.RESET you should investigate as to why.
    You should be getting a VALUE_COMMIT or CHANGE event when selection changes as well and you can trap that and see why it got sent.
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

  • Unable to bind the select() result to datagrid here........in air+sql connection

    <?xml version="1.0" encoding="utf-8"?>
    <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
    <mx:Script>
    <![CDATA[
    import mx.controls.Alert;
    import flash.data.SQLConnection;
    import flash.events.SQLErrorEvent;
    import flash.data.SQLStatement;
    import flash.events.SQLEvent;
    import flash.filesystem.File;
    public function init():void
    // creating a connection and the database
    var conn:SQLConnection = new SQLConnection();
    conn.addEventListener(SQLEvent.OPEN, openHandler);
    conn.addEventListener(SQLErrorEvent.ERROR, errorHandler);
    var dbFile:File = File.applicationStorageDirectory.resolvePath("DBSample.db");
    conn.openAsync(dbFile);
    // putting the database creation into the open handler of conn object
    function openHandler(event:SQLEvent):void
        trace("the database was created successfully");
        var createStmt:SQLStatement = new SQLStatement();
        createStmt.sqlConnection = conn;
    var sql:String =
        "CREATE TABLE IF NOT EXISTS employees (" +
        "    firstName TEXT, " +
        "    lastName TEXT, " +
    createStmt.text = sql;
    createStmt.addEventListener(SQLEvent.RESULT, createResult);
    createStmt.addEventListener(SQLErrorEvent.ERROR, createError);
    createStmt.execute();
    function createResult(event:SQLEvent):void
        Alert.show("Table created");
    // table structure error handle
    function createError(event:SQLErrorEvent):void
        trace("Error message:", event.error.message);
        trace("Details:", event.error.details);
    // error handler for conn object
    function errorHandler(event:SQLErrorEvent):void
        trace("Error message:", event.error.message);
        trace("Details:", event.error.details);
    b2.addEventListener(MouseEvent.CLICK,select);
    // select function
    function select():void
    // select statement
    var selectStmt:SQLStatement = new SQLStatement();
    selectStmt.sqlConnection = conn;
    selectStmt.text = "SELECT firstName, lastName FROM employees";
    selectStmt.addEventListener(SQLEvent.RESULT, resultHandler);
    selectStmt.addEventListener(SQLErrorEvent.ERROR, errorHandler);
    selectStmt.execute();
    function resultHandler(event:SQLEvent):void
        var result:SQLResult = selectStmt.getResult();
        var numResults:int = result.data.length;
        for (var i:int = 0; i < numResults; i++)
            var row:Object = result.data[i];
            var output:String = "firstname: " + row.firstName;
            output += "; lastName: " + row.lastName;
            trace(output);
    b1.addEventListener(MouseEvent.CLICK,insert);
    // insert fuction
    function insert():void
    var insertStmt:SQLStatement = new SQLStatement();
    insertStmt.sqlConnection = conn;
    var sqls:String =
        "INSERT INTO employees  (firstName, lastName)  values(:firstName,:lastName)";
        //""   + "(firstName, lastName) " + "VALUES ('Bob', 'Smith')";
        insertStmt.parameters[":firstName"] = fname.text;
          insertStmt.parameters[":lastName"] = lname.text;
    insertStmt.text = sqls;
    insertStmt.addEventListener(SQLEvent.RESULT, insertResult);
    insertStmt.addEventListener(SQLErrorEvent.ERROR, insertError);
    insertStmt.execute();
    function insertResult(event:SQLEvent):void
        trace("INSERT statement succeeded");
        fname.text="";
        lname.text="";
    function insertError(event:SQLErrorEvent):void
        trace("Error message:", event.error.message);
        trace("Details:", event.error.details);
    ]]>
    </mx:Script>
    <mx:TextInput x="17" y="52" id="fname" />
    <mx:TextInput x="17" y="120" id="lname"/>
    <mx:DataGrid x="375" y="87" dataProvider="">
    <mx:columns>
    <mx:DataGridColumn headerText="fname" dataField="col1"/>
    <mx:DataGridColumn headerText="lname" dataField="col2"/>
    </mx:columns>
    </mx:DataGrid>
    <mx:Button x="58" y="207" id="b1" label="insert" />
    <mx:Button x="375" y="288" id="b2" label="select" />
    </mx:WindowedApplication>

    what about creating an ArrayCollection variable 
         [Bindable]
         private var myAC:ArrayCollection;
    then
    function resultHandler(event:SQLEvent):void
        var  result:SQLResult = selectStmt.getResult();
        myAC = ArrayCollection(result.data);
    and
    <mx:DataGrid dataProvider="{myAc}"/>

  • Drag selection in spark datagrid?

    Is there an easy way to enable a spark DataGrid to use drag selection, similar to how you can select cells in Excel or Google Docs? Or will I need to track mouse movements and manually manipulate the selectedCells?
    Thanks!
    -Aaron

    Couldn't find a built in way to do this, but it turned out to be pretty easy thanks to the GridEvent classes that solve the challenge of know what row/column index the mouse is interacting with. My final solution:
    A class that extends spark::DataGrid
    private var _allowDragSelection:Boolean = false;
    private var dragSelectionAnchor:CellPosition;
    private var dragSelectionStarted:Boolean;
    * If true and selectionMode is GridSelectionMode.MULTIPLE_CELLS the user can drag their
    * mouse to select a rectangular area of cells, just like Excel or Google Docs.
    public function get allowDragSelection():Boolean { return this._allowDragSelection; }
    public function set allowDragSelection(value:Boolean):void {
              if(this._allowDragSelection == value)
                        return;
              this._allowDragSelection = value;
              if(this.allowDragSelection)
                        this.addEventListener(GridEvent.GRID_MOUSE_DOWN, this.handleGridMouseDown);
              else
                        this.removeEventListener(GridEvent.GRID_MOUSE_DOWN, this.handleGridMouseDown);
    private function handleGridMouseDown(e:GridEvent):void {
              if(this.selectionMode != GridSelectionMode.MULTIPLE_CELLS)
                        return;
              this.dragSelectionAnchor = new CellPosition(e.rowIndex, e.columnIndex);
              this.dragSelectionStarted = false;
              this.addEventListener(GridEvent.GRID_MOUSE_DRAG, this.handleGridMouseDrag);
              this.stage.addEventListener(MouseEvent.MOUSE_UP, this.handleDragMouseUp);
    private function handleGridMouseDrag(e:GridEvent):void {
              // don't start processing selection drag until mouse has left the selection anchor
              if(!this.dragSelectionStarted && e.rowIndex == this.dragSelectionAnchor.rowIndex && e.columnIndex == this.dragSelectionAnchor.columnIndex)
                        return;
              // once started, process changes even if the user drags back over the anchor
              this.dragSelectionStarted = true;
              // local to avoid expensive getter cost
              const selectedCells:Vector.<CellPosition> = e.grid.selectedCells;
              // determine the selection rectangle from the anchor to the current cell
              const rowFromIndex:int = Math.min(this.dragSelectionAnchor.rowIndex, e.rowIndex);
              const rowToIndex:int = Math.max(this.dragSelectionAnchor.rowIndex, e.rowIndex);
              const colFromIndex:int = Math.min(this.dragSelectionAnchor.columnIndex, e.columnIndex);
              const colToIndex:int = Math.max(this.dragSelectionAnchor.columnIndex, e.columnIndex);
              // create new cell positions selection vector, and track if any new cell is added
              var cells:Vector.<CellPosition> = new Vector.<CellPosition>();
              var cellsChanged:Boolean = false;
              for(var row:int = rowFromIndex; row <= rowToIndex; row++){
                        for(var col:int = colFromIndex; col <= colToIndex; col++){
                                  var cell:CellPosition = new CellPosition(row, col);
                                  cells.push(cell);
                                  cellsChanged = cellsChanged || !selectedCells.some(function(c:CellPosition, i:int, v:Vector.<CellPosition>):Boolean {
                                            return c.rowIndex == cell.rowIndex && c.columnIndex == cell.columnIndex;
              // assign the new selection only if it changed (Flex is pretty slow here with big selections)
              if(cellsChanged || selectedCells.length != cells.length){
                        this.selectedCells = cells;
                        // maintain the selection anchor for any following SHIFT click selection
                        this.grid.anchorRowIndex = rowFromIndex;
                        this.grid.anchorColumnIndex = colFromIndex;
    private function handleDragMouseUp(e:MouseEvent):void {
              this.removeEventListener(GridEvent.GRID_MOUSE_DRAG, this.handleGridMouseDrag);
              this.stage.removeEventListener(MouseEvent.MOUSE_UP, this.handleDragMouseUp);
    Cheers.
    -Aaron

  • Click drag multi-select in Flex DataGrid

    Is there a way to select multiple items in a DataGrid by clicking and dragging? (ie. clicking the top item and dragging mouse to items below will select them all).
    I have allowMultipleSelection enabled so I can select multiple items using the shift and ctrl keys, however is there a way to do this with only a mouse click?
    I thought allowDragSelection would be the answer but it looks like this is for something else.
    Thanks.

    Hi there...
    the allowMultipleSelection enables a user to use the <CTRL> or <SHIFT> keys in conjunction with the mouse to do multiple selections.  The control key allows mutiples one-by-one while the shift key lets you grab a block of folks.  To my knowledge there isn't a way to do a mouse-only multiple selection.
    HTH,
    Adrian

  • How can I set a property when an event happens? (selection changed on datagrid)

    I have a datagrid, I would like to change the backgrund of the datagrid when the selection changed event is fired.
    I can not use data trigger, because is in the case that I expected a value, but in this case is when change, to any value.
    An option is to use an event trigger, but all the examples that I have found is to use with an actions, and I just want to set a property.
    How could I do that?
    I am using MVVM pattern, so I would like to avoid the use in code-behind.
    Thank so much.

    You could use an event trigger and implement your own TriggerAction<T> that sets the background property. There is an example of how to create a custom TriggerAction available here:
    http://stackoverflow.com/questions/942548/setting-a-property-with-an-eventtrigger.
    The following example sets the Background property of the DataGrid to a red SolidColorBrush when the SelectionChanged event is fired. It should give you the idea:
    <DataGrid x:Name="dgrid"
    xmlns:local="clr-namespace:WpfApplication22">
    <i:Interaction.Triggers>
    <i:EventTrigger EventName="SelectionChanged">
    <local:SetPropertyAction PropertyName="Background" TargetObject="{Binding ElementName=dgrid}">
    <local:SetPropertyAction.PropertyValue>
    <SolidColorBrush>Red</SolidColorBrush>
    </local:SetPropertyAction.PropertyValue>
    </local:SetPropertyAction>
    </i:EventTrigger>
    </i:Interaction.Triggers>
    <DataGrid.Columns>
    namespace WpfApplication22
    public class SetPropertyAction : TriggerAction<FrameworkElement>
    public string PropertyName
    get { return (string)GetValue(PropertyNameProperty); }
    set { SetValue(PropertyNameProperty, value); }
    public static readonly DependencyProperty PropertyNameProperty
    = DependencyProperty.Register("PropertyName", typeof(string),
    typeof(SetPropertyAction));
    public object PropertyValue
    get { return GetValue(PropertyValueProperty); }
    set { SetValue(PropertyValueProperty, value); }
    public static readonly DependencyProperty PropertyValueProperty
    = DependencyProperty.Register("PropertyValue", typeof(object),
    typeof(SetPropertyAction));
    public object TargetObject
    get { return GetValue(TargetObjectProperty); }
    set { SetValue(TargetObjectProperty, value); }
    public static readonly DependencyProperty TargetObjectProperty
    = DependencyProperty.Register("TargetObject", typeof(object),
    typeof(SetPropertyAction));
    protected override void Invoke(object parameter)
    object target = TargetObject ?? AssociatedObject;
    PropertyInfo propertyInfo = target.GetType().GetProperty(
    PropertyName,
    BindingFlags.Instance|BindingFlags.Public
    |BindingFlags.NonPublic|BindingFlags.InvokeMethod);
    propertyInfo.SetValue(target, PropertyValue);
    For more information about how to hook up event triggers and handle events in MVVM, please refer to my blog post:
    http://blog.magnusmontin.net/2013/06/30/handling-events-in-an-mvvm-wpf-application/
    Please also remember to mark helpful posts as answer.

  • Updating charts and datagrids based on selection

    I am trying to find some documentation and samples explaining how I can pick something in a combobox and have it populate a series of datagrids and charts.
    OUTLINE:
    A.  Using an XML table of all municipalities in our region populate a combobox.  Then have the user select the municipality they are interested in.
    B.Take a census table that is in XML format and by using HTTPServices read it into Flex and then based on what municipality the user selected populate a datagrid and variety of charts with data pertaining to the muni.
    I know it is done because I see it all the time and took a class last week where it was shown.  Unfortunately it was the last day of the class and time was running out so we just got a brief overview of this.
    I would greatly appriciate anyone who can point me to samples and documentation whether it be online or in books.  And I should mention that terminology is still an issue.  Am I attempting to do a custom event or what?
    The code below all works.  What I mean I am successfully populating the combobox and the datagrid with the appropriate data.  I am just not able to get the two communicating with each other.  In other words the datagrid is showing the entire table and ignoring the combobox.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="vertical"
    creationComplete="initApp()">
    <mx:Script>
      <![CDATA[
       import mx.rpc.events.*;
       import mx.controls.*;
       import mx.charts.*;
       import mx.collections.*;
       [Bindable]
       private var acMuni:ArrayCollection = new ArrayCollection;
       [Bindable]
       private var acCity:ArrayCollection = new ArrayCollection;
       private function initApp():void {
        muniHS.send();
        cityHS.send();
       private function eHandler(e:ResultEvent):void {
        acMuni = e.result.GetAllMUNIS.MUNIS;
       private function fHandler(e:FaultEvent):void {
        var faultInfo:String="fault code: "+ e.fault.faultCode +"\n\n";
        faultInfo+="fault string: "+e.fault.faultString+"\n\n";
        mx.controls.Alert.show(faultInfo,"Fault Information");
        var eventInfo:String="event target: "+e.target+"\n\n";
        eventInfo+="event type: "+e.type+"\n\n";
        mx.controls.Alert.show(eventInfo,"Event Information");
       private function eCityHandler(e:ResultEvent):void {
        this.acCity = e.result.GetCITIES.CITIES;
      ]]>
    </mx:Script>
    <mx:HTTPService id="muniHS"
      url="data/GetAllMunis.xml"
      result="eHandler(event)"
      fault="fHandler(event)"
      showBusyCursor="true"/>
    <mx:HTTPService id="cityHS"
      url="data/CityNames.xml"
      resultFormat="object"
      result="eCityHandler(event)"
      fault="fHandler(event)"
      showBusyCursor="true"/>
    <mx:Panel width="100%" height="50%"
      paddingBottom="10"
      paddingLeft="10"
      paddingRight="10"
      paddingTop="10" title="DataGrid">
    <mx:ComboBox id="muniCB"
      dataProvider="{acCity}"
      prompt="Select a Municipality"
      labelField="city"/>
      <mx:DataGrid id="dg"
       width="100%"
       height="100%"
       dataProvider="{acMuni}">
       <mx:columns>
        <mx:DataGridColumn headerText="municipality" dataField="city"/>
        <mx:DataGridColumn dataField="year"/>
        <mx:DataGridColumn headerText="month" dataField="month_no"/>
        <mx:DataGridColumn headerText="labor force" dataField="laborforce"/>
        <mx:DataGridColumn dataField="employed"/>
        <mx:DataGridColumn dataField="unemployed"/>
        <mx:DataGridColumn headerText="unemployment rate" dataField="unemp_rate"/>
        <mx:DataGridColumn headerText="tract" dataField="geogkey"/>
        <mx:DataGridColumn headerText="extended tract" dataField="geogkeyx"/>
       </mx:columns>
      </mx:DataGrid>
    </mx:Panel>
    </mx:Application>
    Thanks for any help you can provide
    Richard Krell

    If this post answers your querstion or helps, please mark it as such.
    First, use XMLListCollection for the data for the ConboBox and for the Muni result handler xlcMuni (instead of acMuni).
    Here is a simplified version of your app with the answer. It uses e4x syntax for filtering.
    http://livedocs.adobe.com/flex/3/html/help.html?content=13_Working_with_XML_03.html
    --------------- CityNames.xml ----------------
    <?xml version="1.0" encoding="utf-8"?>
    <CITIES>
      <city>Chicago</city>
      <city>New York</city>
      <city>Boston</city>
    </CITIES>
    ---------- GetAllMunis.xml ------------
    <?xml version="1.0" encoding="utf-8"?>
    <MUNIS>
      <muni>
        <city>Chicago</city>
        <year>1866</year>
      </muni>
      <muni>
        <city>New York</city>
        <year>1872</year>
      </muni>
      <muni>
        <city>Boston</city>
        <year>1756</year>
      </muni>
    </MUNIS>
    ------------- MainApp.mxml -------------------
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
      creationComplete="muniHS.send();cityHS.send();">
      <mx:Script>
        <![CDATA[
          import mx.events.ListEvent;
          import mx.rpc.events.*;
          import mx.controls.*;
          import mx.charts.*;
          import mx.collections.*;
          [Bindable] private var xlcMuni:XMLListCollection = new XMLListCollection;
          [Bindable] private var xlcCity:XMLListCollection = new XMLListCollection;
          [Bindable] private var xlcDG:XMLListCollection = new XMLListCollection;
          private function eHandler(e:ResultEvent):void {
            this.xlcMuni = new XMLListCollection(e.result..muni);
          private function eCityHandler(e:ResultEvent):void {
            this.xlcCity = new XMLListCollection(e.result.city);
          private function populateDG(evt:ListEvent):void{
            var temp:XMLList = xlcMuni.copy();
            xlcDG = new XMLListCollection(temp.(city == ComboBox(evt.currentTarget).selectedItem));
        ]]>
      </mx:Script>
      <mx:HTTPService id="muniHS" resultFormat="e4x"
        url="data/GetAllMunis.xml" useProxy="false"
        result="eHandler(event)"/>
      <mx:HTTPService id="cityHS" url="data/CityNames.xml"
        resultFormat="e4x" result="eCityHandler(event)"/>
      <mx:Panel width="100%" height="50%" title="DataGrid">
        <mx:ComboBox id="muniCB" dataProvider="{xlcCity}"
          prompt="Select a Municipality" labelField="city"
          change="populateDG(event)"/>
        <mx:DataGrid id="dg" width="100%" height="100%"
          dataProvider="{xlcDG}">
          <mx:columns>
            <mx:DataGridColumn headerText="municipality" dataField="city"/>
            <mx:DataGridColumn dataField="year"/>
          </mx:columns>
        </mx:DataGrid>
      </mx:Panel>
    </mx:Application>

  • DataGrid, selecting, highlighting, navigating to a row

    In Flash MX 2004
    I would like to have a row selected after the DataGrid has
    been populated.
    Much like a list box <select> in html, I would like to
    make one row
    "selected". It must be navigated to and highlighted to
    visually indicate the
    selection.
    However, the focusedCell property does not work when
    dg.editable=false
    So, I set the dg.editable=true, set the focusedCell to the
    appropriate row
    and cell then set the dg.editable=false. But this left the
    chosen cell in an
    editable (textbox) state that you would have to click out of
    in order to see
    all the contents of that cell. Ugly.
    With the fine suggestion of DMennenoh, I used the
    .selectedIndex property to
    choose the selected row, but, although the item is in fact
    selected, the
    datagrid does not navigate to the selected field. It stays on
    the first row.
    You must scroll through the list to see the selected row.
    Is there a way to progarmmatically choose and navigate to a
    row in a
    DataGrid without this effect?
    Julian

    myDG.setSelected(0)
    "stjulian" <[email protected]> wrote
    in message
    news:e7pnao$ilo$[email protected]..
    > In Flash MX 2004
    >
    > I would like to have a row selected after the DataGrid
    has been populated.
    > Much like a list box <select> in html, I would
    like to make one row
    > "selected". It must be navigated to and highlighted to
    visually indicate
    > the
    > selection.
    >
    > However, the focusedCell property does not work when
    dg.editable=false
    >
    > So, I set the dg.editable=true, set the focusedCell to
    the appropriate row
    > and cell then set the dg.editable=false. But this left
    the chosen cell in
    > an
    > editable (textbox) state that you would have to click
    out of in order to
    > see
    > all the contents of that cell. Ugly.
    >
    > With the fine suggestion of DMennenoh, I used the
    .selectedIndex property
    > to
    > choose the selected row, but, although the item is in
    fact selected, the
    > datagrid does not navigate to the selected field. It
    stays on the first
    > row.
    > You must scroll through the list to see the selected
    row.
    >
    > Is there a way to progarmmatically choose and navigate
    to a row in a
    > DataGrid without this effect?
    >
    >
    > Julian
    >
    >

  • Datagrid multiple selection

    Hello
    My client wants to have a possibility of multiple selections
    in a datagrid... but he wants to have them selected by a simple
    click instead of the "classical" ctrl click... how can I achieve
    that ?
    Henri

    What you can do is use the selectedIndices property of the
    grid. Keep a
    separate array - call it indices. When a click on the grid is
    made, get the
    grids.selectedIndex and then add that to you indices array.
    Then set the
    grids.selectedIndices to your indices array. Make sure you
    set the grids
    multipleSelection property to true.
    Dave -
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • List, datagrids selection effects

    you know hen you select an item from datagrid or list in
    flash, how it selects it, in flex however, it just fades on it,
    does anyone know how to make flex select items from datagrids or
    lists select like flash.

    Hi There,
    that would be a very long list! are you after anything in particular?
    Beyond the usual wipes, mixes in their various flavours (iris, edge, jaws etc) youve got page peels, 3d transitiions - literally hundreds of transitions especially when you start modifying them yourself, add that to the huge list of free and low cost plugins available Im not sure you could ever provide an exhaustive list, & then you've got motion as part of the package too!
    Suffice to say that you would be extremely unlikely to ever use all the transitions in your career, indeed personally there are only a tiny, tiny handfull that I ever use professionally, 99% are cuts to tell the story.
    Its a great package though (hopefully about to get even better!) you wont go far wrong with it if it suits your workflow, what are you hoping to achieve with FCP?
    cheers
    Andy

  • How to open a link by clicking on a DataGrid row

    I have a list of documents that are accessible over the internet.  The list is in an XML file which serves as the data source for a DataGrid.  What I cannot figure out is how to open the document selected in the DataGrid.  I think that I need to change something in the openDocument function (below) but I am not certain what I should change.  Any help would be appeciated.
    Sample file are below:
    Application
    viewDocuments.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="absolute"
    creationComplete="initApp();">
    <mx:Script>
    <![CDATA[
    import mx.collections.ArrayCollection;
    import mx.rpc.events.ResultEvent;
    import mx.core.Application;
    [Bindable]
    private var documents:ArrayCollection;
    private function initApp():void
    this.srv.send();
    private function onResult(evt:ResultEvent):void
    this.documents=evt.result.data.document;
    private function openDocument():void
    var docURL:String;
    docURL=dgDocuments.selectedItem.url;
    navigateToURL(new URLRequest("http://cnn.com/"), "_blank");
    //Below does not work
    //navigateToURL(new URLRequest("docURL"), "_blank");
    ]]>
    </mx:Script>
    <mx:HTTPService id="srv"
    url="documents.xml"
    resultFormat="object"
    result="onResult(event)"/>
    <mx:Canvas id="cViewDocumentsContainer"
    x="0"
    y="0"
    width="100%"
    height="100%">
    <mx:DataGrid id="dgDocuments"
    width="600"
    height="186"
    dataProvider="{documents}"
    x="15"
    y="74"
    doubleClickEnabled="true"
    doubleClick="openDocument();">
    <mx:columns>
    <mx:DataGridColumn headerText="DocID"
    dataField="doc_id"
    visible="true"/>
    <mx:DataGridColumn headerText="Name"
    dataField="name"
    visible="true"
    width="200"/>
    <mx:DataGridColumn headerText="Type"
    dataField="type"
    visible="true"
    width="90"/>
    <mx:DataGridColumn headerText="File Name"
    dataField="filename"
    visible="true"/>
    <mx:DataGridColumn headerText="Path"
    dataField="url"
    visible="true" width="200"/>
    </mx:columns>
    </mx:DataGrid>
    <mx:Text x="10"
    y="10"
    text="View Documents"
    fontSize="12"
    fontWeight="bold"/>
    <mx:Text x="15"
    y="48"
    text="Double-click on the document below you want to read. The document will open in a new window."/>
    </mx:Canvas>
    </mx:Application>
    Data
    documents.xml
    <?xml version="1.0" encoding="utf-8"?>
    <data>
    <document>
    <doc_id>1</doc_id>
    <name>CNN</name>
    <type>URL</type>
    <filename>CNN.com</filename>
    <url>http://cnn.com/</url>
    </document>
    <document>
    <doc_id>2</doc_id>
    <name>Yahoo</name>
    <type>URL</type>
    <filename>Yahoo.com</filename>
    <url>http://yahoo.com/</url>
    </document>
    </data>
    Thanks!
    Lee

    You need this (removed double quotes):
    navigateToURL(
    new URLRequest(docURL), "_blank");
    If this post answers your question or helps, please mark it as such.
    Greg Lafrance
    www.ChikaraDev.com
    Flex Development and Support Services

Maybe you are looking for

  • Error when running a report on CMC

    Error in File Maintenance Costs by Work Code: Max processing time or Max records limit reached . I can run this report through Crystal Reports 9 installed on my desktop and do not have any problems having data returned.  However, when I upload it to

  • Can't mount root

    Hi, I am trying to create a proper kernel for my headless server. I use a Intel SS4200. It holds four SATA drives and a single PATA drive, I believe. I have installed Arch in the PATA-drive and I want to boot from this. I use a 8 GB DOM similar to th

  • Mac OS 10.6.4 Update/Download Issue

    I just got a new Macbook and of course the software update had a lot of updates it that needed to run. Including Mac OS 10.6.4 and Safari 5.0.1. I tried downloading them and my connection got lost in the middle of the download. I tried the download a

  • Itunes says ios 4.2.1 is most current update for my phone??

    I have Itunes 10.5, my I phone is still running on 4.2.1, I tunes says it is the most up to date software, and there are no updates available. What do I need to do to install the lastest update??

  • Delivery Date for Purchase Order

    Experts, which table contains the delivery date for a Purchase Order (NB). ? Thanks in advance Jörg