If I'm not wrong that is a bug in 2.0.1 (it was not in 2.0)...

2007/3/9, Sergey Kovalyov <[EMAIL PROTECTED]>:

  Hi All!

I have a DataGrid and its dataProvider property is binded to
ArrayCollection. When I first hide one column via firstColumn.visible =
false and then binding executes, that column appears again. How to prevent
this unnecessary appearance? Click "Hide Middle Name" and then "Populate" in
this example:

<?xml version="1.0" encoding="utf-8"?>

<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml";

creationComplete="onCreationComplete()"
>

<mx:Script>

<![CDATA[

*import* mx.collections.ArrayCollection;

[
*Bindable*]

*protected* *var* users : ArrayCollection;

*protected* *function* onCreationComplete() : * void* {

users =
*new* ArrayCollection();

users.addItem({firstName :
*"George"*, middleName : *"W"* , lastName : *"Bush"*});

}

*protected* *function* onPopulateButtonClick() : * void* {

users =
*new* ArrayCollection();

users.addItem({firstName :
*"Victor"*, middleName : *"A"* , lastName : *"Yuschenko"*});

}

]]>

</mx:Script>

<mx:DataGrid dataProvider="{users} ">

<mx:columns>

<mx:DataGridColumn id="firstNameDataGridColumn" dataField=" firstName"
headerText="First Name" />

<mx:DataGridColumn id="middleNameDataGridColumn" dataField=" middleName"
headerText="Middle Name" />

<mx:DataGridColumn id="lastNameDataGridColumn*" * dataField="lastName"
headerText="Last Name" />

</mx:columns>

</mx:DataGrid>

<mx:Button label="Hide Middle Name*"* click="
middleNameDataGridColumn.visible = *false*" />

<mx:Button label="Populate" click="onPopulateButtonClick()" />

</mx:Application>
Sergey.




--
::| Carlos Rovira
::| http://www.carlosrovira.com
::| http://www.madeinflex.com

Reply via email to