Hi again,

I did another test,

When you add

dg.invalidateList();

You click addRow(), the first itme nothing happens, you click addRow() again, both new items show up in the dg.

I havn't worked to much with the lists but, this dosn't seem like a proper behavior. Bug Adobe?

Peace, Mike

On 6/13/06, Michael Schmalle <[EMAIL PROTECTED]> wrote:
Hi,

I just looked at the source for the DataGrid,

When you press a header, all they are doing is calling collection.refresh().

I don't understand why it is not getting updated instantly.

Peace, Mike


On 6/13/06, Michael Schmalle < [EMAIL PROTECTED]> wrote:
Hi,

I tried you example

this works.. kindof

ICollectionView(dg.dataProvider).refresh();

It dosn't seem to work until you hit a header, then it works always.

Peace, Mike


On 6/13/06, Scott Romer < [EMAIL PROTECTED]> wrote:

Hello -

I have some design constraints which is forcing me to use an Array
behind the scenes for updating a dataGrid. In either case, I have a
simpler version of the code here, that basically follows an example in
the docs except that the update is made directly to the array rather
than using the suggested addItemAt(), setItemAt() methods.

I have confirmed that addItemAt and setItemAt do cause the dataGrid to
redraw, however, I need to find what event I need to trigger and/or
listen for to get the redraw to work if I am updating the array myself.

See the following code:
[---START CODE---]
<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
backgroundAlpha="0"
initialize="initImpl()">

<mx:Script>

import mx.collections.ArrayCollection;

[Bindable]
public var employees:Array = new Array();

private function initImpl():void
{
dg.dataProvider = new ArrayCollection(employees);
}

private function addRow():void
{
if (frmName.text != "")
{
employees[employees.length] = {name: frmName.text,
email: email.text, phone: phone.text};
}
}

private function updateRow():void
{
if (dg.selectedIndex != -1)
{
employees[dg.selectedIndex] = {name: frmName.text,
email: email.text, phone: phone.text};
}
}

</mx:Script>

<mx:HBox width="100%" height="100%">

<mx:DataGrid id="dg" width="100%" height="100%">
<mx:columns>
<mx:Array>
<mx:DataGridColumn dataField="name"
headerText="Name"/>
<mx:DataGridColumn dataField="phone"
headerText="Phone"/>
<mx:DataGridColumn dataField="email"
headerText="Email"/>
</mx:Array>
</mx:columns>
</mx:DataGrid>

<mx:Form width="100%" height="100%">
<mx:FormItem label="Name">
<mx:TextInput id="frmName" width="200"
text="{dg.selectedItem.name}"/>
</mx:FormItem>
<mx:FormItem label="Email">
<mx:TextInput id="email" width="200"
text="{dg.selectedItem.email}"/>
</mx:FormItem>
<mx:FormItem label="Phone">
<mx:TextInput id="phone" width="200"
text="{dg.selectedItem.phone}"/>
</mx:FormItem>
<mx:FormItem>
<mx:HBox>
<mx:Button label="Update" click="updateRow()"/>
<mx:Button label="Add" click="addRow()"/>
</mx:HBox>
</mx:FormItem>
</mx:Form>

</mx:HBox>

</mx:Application>

[---END CODE---]

I've tried listening for collection events and calling
invalidateDisplayList(), but that doesn't seem to work. Any other ideas?

Thanks,
-scott




--
What goes up, does come down.



--
What goes up, does come down.



--
What goes up, does come down. __._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to