[flexcoders] What Am I doing Wrong, View will not update when bound data is changed.

2008-12-04 Thread donvoltz
Using Cairngorm, I am maintaining an ArrayCollection of a custom data
type. This data is bound to the view, however, when I update the data
in the ArrayCollection, the view is not updated until I redraw all of
the custom components. Is there a way for each component to respond
when I modify the data?

Here is the code

CUSTOM COMPONENT

?xml version=1.0 encoding=utf-8?
mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml; width=100%
height=100% borderStyle=outset cornerRadius=20
mx:Script
![CDATA[
import com.dynamicmedicalventures.or_metrics.RoomModel;
import mx.events.FlexEvent;

[Bindable]
private var _data:RoomModel;

override public function set data(value:Object):void{
if(value != null){
super.data = value;
this._data = value as RoomModel;
}
dispatchEvent(new 
FlexEvent(FlexEvent.DATA_CHANGE));
super.invalidateProperties();

}

override protected function commitProperties():void {
super.commitProperties();
if(data != _data){
_data = data as RoomModel;
}
}


]]
/mx:Script

mx:Label x=10 y=10 fontSize=14 fontWeight=bold
id=roomTitle text={_data.roomData.roomName}/
mx:Image x=846 y=10 id=roomStatus/
mx:List x=10 y=86 width=580 height=312 id=caseList
dragEnabled=true dropEnabled=true dataProvider={_data.caseList} /
mx:Label x=10 y=60 text=Case List/
mx:Label x=618 y=60 text=Main Staff/
mx:Label x=618 y=204 text=Misc Staff/
mx:List x=618 y=86 width=163 id=mainList height=110
dataProvider={_data.mainStaff} /
mx:List x=619 y=230 id=miscList width=163 height=110
dataProvider={_data.miscStaff} /
mx:Label x=10 y=415 text=Equipment List/
mx:HorizontalList x=10 y=441 width=580
dataProvider={_data.equipmentList} /
mx:Label x=619 y=360 text=Messages amp; Alerts/
mx:TextArea x=619 y=389 width=259 height=112/

/mx:Canvas

In the main application I am adding many of these custom components to
a VBOX, here is that code snippit

for (var i:int = 0; imodelLocator.RoomModelCollection.length; i++){
var newRoom:RoomView = new RoomView()
newRoom.data = 
modelLocator.RoomModelCollection.getItemAt(i);
if(allRoomsBox) {
allRoomsBox.addChild(newRoom);
}
}


Thanks for any help

Don



RE: [flexcoders] What Am I doing Wrong, View will not update when bound data is changed.

2008-12-04 Thread Dimitrios Gianninas
Is the [Bindable] tag present at the top of the RoomModel declaration?
 
Dimitrios Gianninas
RIA Developer Team Lead
Optimal Payments Inc.
 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of donvoltz
Sent: Thursday, December 04, 2008 4:06 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] What Am I doing Wrong, View will not update when bound 
data is changed.



Using Cairngorm, I am maintaining an ArrayCollection of a custom data
type. This data is bound to the view, however, when I update the data
in the ArrayCollection, the view is not updated until I redraw all of
the custom components. Is there a way for each component to respond
when I modify the data?

Here is the code

CUSTOM COMPONENT

?xml version=1.0 encoding=utf-8?
mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml 
http://www.adobe.com/2006/mxml  width=100%
height=100% borderStyle=outset cornerRadius=20
mx:Script
![CDATA[
import com.dynamicmedicalventures.or_metrics.RoomModel;
import mx.events.FlexEvent;

[Bindable]
private var _data:RoomModel;

override public function set data(value:Object):void{
if(value != null){
super.data = value;
this._data = value as RoomModel;
}
dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
super.invalidateProperties();

}

override protected function commitProperties():void {
super.commitProperties();
if(data != _data){
_data = data as RoomModel;
}
}


]]
/mx:Script

mx:Label x=10 y=10 fontSize=14 fontWeight=bold
id=roomTitle text={_data.roomData.roomName}/
mx:Image x=846 y=10 id=roomStatus/
mx:List x=10 y=86 width=580 height=312 id=caseList
dragEnabled=true dropEnabled=true dataProvider={_data.caseList} /
mx:Label x=10 y=60 text=Case List/
mx:Label x=618 y=60 text=Main Staff/
mx:Label x=618 y=204 text=Misc Staff/
mx:List x=618 y=86 width=163 id=mainList height=110
dataProvider={_data.mainStaff} /
mx:List x=619 y=230 id=miscList width=163 height=110
dataProvider={_data.miscStaff} /
mx:Label x=10 y=415 text=Equipment List/
mx:HorizontalList x=10 y=441 width=580
dataProvider={_data.equipmentList} /
mx:Label x=619 y=360 text=Messages amp; Alerts/
mx:TextArea x=619 y=389 width=259 height=112/

/mx:Canvas

In the main application I am adding many of these custom components to
a VBOX, here is that code snippit

for (var i:int = 0; imodelLocator.RoomModelCollection.length; i++){
var newRoom:RoomView = new RoomView()
newRoom.data = modelLocator.RoomModelCollection.getItemAt(i);
if(allRoomsBox) {
allRoomsBox.addChild(newRoom);
}
}

Thanks for any help

Don



 

-- 
WARNING
---
This electronic message and its attachments may contain confidential, 
proprietary or legally privileged information, which is solely for the use of 
the intended recipient.  No privilege or other rights are waived by any 
unintended transmission or unauthorized retransmission of this message.  If you 
are not the intended recipient of this message, or if you have received it in 
error, you should immediately stop reading this message and delete it and all 
attachments from your system.  The reading, distribution, copying or other use 
of this message or its attachments by unintended recipients is unauthorized and 
may be unlawful.  If you have received this e-mail in error, please notify the 
sender.

AVIS IMPORTANT
--
Ce message électronique et ses pièces jointes peuvent contenir des 
renseignements confidentiels, exclusifs ou légalement privilégiés destinés au 
seul usage du destinataire visé.  L'expéditeur original ne renonce à aucun 
privilège ou à aucun autre droit si le présent message a été transmis 
involontairement ou s'il est retransmis sans son autorisation.  Si vous n'êtes 
pas le destinataire visé du présent message ou si vous l'avez reçu par erreur, 
veuillez cesser immédiatement de le lire et le supprimer, ainsi que toutes ses 
pièces jointes, de votre système.  La lecture, la distribution, la copie ou 
tout autre usage du présent message ou de ses pièces jointes par des personnes 
autres que le destinataire visé ne sont pas autorisés et pourraient être 
illégaux.  Si vous avez reçu ce courrier électronique par erreur, veuillez en 
aviser l'expéditeur.



RE: [flexcoders] What Am I doing Wrong, View will not update when bound data is changed.

2008-12-04 Thread Tracy Spratt
How are you updating the item?  If you use the collection API, the UI should 
update.  If you are directly assigning a value to an item property, then you 
should call itemUpdated(item).

 

Tracy

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
Dimitrios Gianninas
Sent: Thursday, December 04, 2008 8:32 AM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] What Am I doing Wrong, View will not update when 
bound data is changed.

 

Is the [Bindable] tag present at the top of the RoomModel declaration?

 

Dimitrios Gianninas

RIA Developer Team Lead

Optimal Payments Inc.

 

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of donvoltz
Sent: Thursday, December 04, 2008 4:06 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] What Am I doing Wrong, View will not update when bound 
data is changed.

Using Cairngorm, I am maintaining an ArrayCollection of a custom data
type. This data is bound to the view, however, when I update the data
in the ArrayCollection, the view is not updated until I redraw all of
the custom components. Is there a way for each component to respond
when I modify the data?

Here is the code

CUSTOM COMPONENT

?xml version=1.0 encoding=utf-8?
mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml 
http://www.adobe.com/2006/mxml  width=100%
height=100% borderStyle=outset cornerRadius=20
mx:Script
![CDATA[
import com.dynamicmedicalventures.or_metrics.RoomModel;
import mx.events.FlexEvent;

[Bindable]
private var _data:RoomModel;

override public function set data(value:Object):void{
if(value != null){
super.data = value;
this._data = value as RoomModel;
}
dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
super.invalidateProperties();

}

override protected function commitProperties():void {
super.commitProperties();
if(data != _data){
_data = data as RoomModel;
}
}


]]
/mx:Script

mx:Label x=10 y=10 fontSize=14 fontWeight=bold
id=roomTitle text={_data.roomData.roomName}/
mx:Image x=846 y=10 id=roomStatus/
mx:List x=10 y=86 width=580 height=312 id=caseList
dragEnabled=true dropEnabled=true dataProvider={_data.caseList} /
mx:Label x=10 y=60 text=Case List/
mx:Label x=618 y=60 text=Main Staff/
mx:Label x=618 y=204 text=Misc Staff/
mx:List x=618 y=86 width=163 id=mainList height=110
dataProvider={_data.mainStaff} /
mx:List x=619 y=230 id=miscList width=163 height=110
dataProvider={_data.miscStaff} /
mx:Label x=10 y=415 text=Equipment List/
mx:HorizontalList x=10 y=441 width=580
dataProvider={_data.equipmentList} /
mx:Label x=619 y=360 text=Messages amp; Alerts/
mx:TextArea x=619 y=389 width=259 height=112/

/mx:Canvas

In the main application I am adding many of these custom components to
a VBOX, here is that code snippit

for (var i:int = 0; imodelLocator.RoomModelCollection.length; i++){
var newRoom:RoomView = new RoomView()
newRoom.data = modelLocator.RoomModelCollection.getItemAt(i);
if(allRoomsBox) {
allRoomsBox.addChild(newRoom);
}
}

Thanks for any help

Don

AVIS IMPORTANT

WARNING

Ce message électronique et ses pièces jointes peuvent contenir des 
renseignements confidentiels, exclusifs ou légalement privilégiés destinés au 
seul usage du destinataire visé. L'expéditeur original ne renonce à aucun 
privilège ou à aucun autre droit si le présent message a été transmis 
involontairement ou s'il est retransmis sans son autorisation. Si vous n'êtes 
pas le destinataire visé du présent message ou si vous l'avez reçu par erreur, 
veuillez cesser immédiatement de le lire et le supprimer, ainsi que toutes ses 
pièces jointes, de votre système. La lecture, la distribution, la copie ou tout 
autre usage du présent message ou de ses pièces jointes par des personnes 
autres que le destinataire visé ne sont pas autorisés et pourraient être 
illégaux. Si vous avez reçu ce courrier électronique par erreur, veuillez en 
aviser l'expéditeur.

This electronic message and its attachments may contain confidential, 
proprietary or legally privileged information, which is solely for the use of 
the intended recipient. No privilege or other rights are waived by any 
unintended transmission or unauthorized retransmission of this message. If you 
are not the intended recipient of this message, or if you have received it in 
error, you should immediately stop reading this message and delete it and all 
attachments from your system. The reading, distribution, copying or other use 
of this message or its attachments by unintended recipients is unauthorized and 
may be unlawful. If you have received this e-mail in error, please notify the 
sender.