This will pull the value of a simple combo box, then find that column in the datagrid, pull it to the first row, then sort it by that column.
Is there a way to "refresh" the datagrid without doing a sort?
***AS function code ***
private function pickColumn(selection:String, gridToSort:DataGrid):void
{
var swappedDataField:String = new String();
for (var i:Number = 0; i < gridToSort.columns.length; i++)
{
if (gridToSort.columns[i].dataField == selection)
{
swappedDataField = gridToSort.columns[0].dataField;
gridToSort.columns[0].dataField = selection;
gridToSort.columns[i].dataField = swappedDataField;
gridToSort.sortByColumn (0);
}
}
}
*** comboBox mxm ***
// "columndata" is a model of the column names/data fields; "grid" is the id of my DataGrid to affect
<mx:ComboBox dataProvider="{columndata}" id="addColumn" change="pickColumn( addColumn.selectedItem.toString(),grid)" />
On 3/31/06, Manish Jethani <[EMAIL PROTECTED]
> wrote:
On 3/31/06, Tom Ortega <[EMAIL PROTECTED]> wrote:
> I know you can drag and drop columns to reorder them, but I want to do that dynamically.
Get the "columns" property, swap the elements, and set it back. That
should do the trick.
Manish
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service .
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

