You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pe...@apache.org on 2016/12/14 22:10:14 UTC
git commit: [flex-asjs] [refs/heads/develop] - Enabled set
selectedIndex on DataGrid to programmatically select a row.
Repository: flex-asjs
Updated Branches:
refs/heads/develop a11bb25ce -> b05a60d72
Enabled set selectedIndex on DataGrid to programmatically select a row.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/b05a60d7
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/b05a60d7
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/b05a60d7
Branch: refs/heads/develop
Commit: b05a60d72204440229d37a119d02bdb137b88165
Parents: a11bb25
Author: Peter Ent <pe...@apache.org>
Authored: Wed Dec 14 17:10:11 2016 -0500
Committer: Peter Ent <pe...@apache.org>
Committed: Wed Dec 14 17:10:11 2016 -0500
----------------------------------------------------------------------
.../src/main/flex/org/apache/flex/html/DataGrid.as | 4 ++++
.../flex/org/apache/flex/html/beads/DataGridView.as | 16 ++++++++++++++++
2 files changed, 20 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b05a60d7/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/DataGrid.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/DataGrid.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/DataGrid.as
index c271134..30c3edb 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/DataGrid.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/DataGrid.as
@@ -103,6 +103,10 @@ package org.apache.flex.html
{
return IDataGridModel(model).selectedIndex;
}
+ public function set selectedIndex(value:int):void
+ {
+ IDataGridModel(model).selectedIndex = value;
+ }
/**
* The DataGrid's presentation model
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b05a60d7/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataGridView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataGridView.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataGridView.as
index 8393057..e8f4efe 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataGridView.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataGridView.as
@@ -159,6 +159,7 @@ package org.apache.flex.html.beads
var sharedModel:IDataGridModel = _strand.getBeadByType(IBeadModel) as IDataGridModel;
IEventDispatcher(sharedModel).addEventListener("dataProviderChanged",handleDataProviderChanged);
+ IEventDispatcher(sharedModel).addEventListener("selectedIndexChanged", handleSelectedIndexChanged);
var columnLabels:Array = new Array();
@@ -213,6 +214,21 @@ package org.apache.flex.html.beads
host.dispatchEvent(new Event("layoutNeeded"));
}
+
+ /**
+ * @private
+ */
+ private function handleSelectedIndexChanged(event:Event):void
+ {
+ var sharedModel:IDataGridModel = _strand.getBeadByType(IBeadModel) as IDataGridModel;
+ var newIndex:int = sharedModel.selectedIndex;
+
+ for (var i:int=0; i < _lists.length; i++)
+ {
+ var list:DataGridColumnList = _lists[i] as DataGridColumnList;
+ list.selectedIndex = newIndex;
+ }
+ }
/**
* @private