flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Harui <aha...@adobe.com>
Subject Re: Binding not works expectedly
Date Thu, 10 Mar 2016 21:39:50 GMT
Not sure I understand, but if you are changing fields in the items in a
data provider, you may need to dispatch a change event when done.  The
collections currently don't watch the items.  That is a to-do item.  If
you want to try to create a version of Collections that does that, it
would be great.

-Alex

On 3/10/16, 3:23 AM, "santanu4ver" <santanu4ver@gmail.com> wrote:

>Hi,
>
>I couldn't able to make this binding works in a component page (I followed
>demo projects supplied within FlexJS SDK) when output as HTML.
>
>My InitialView.mxml uses <states> and I'm trying to inject a ValueObject
>inside component in another state upon selecting a DataGrid item:
>
>/<js:ViewBase xmlns:fx="http://ns.adobe.com/mxml/2009"
>			 xmlns:js="library://ns.apache.org/flexjs/basic"
>			 width="100%" height="100%" initComplete="onCreationCompletes(event)"
>xmlns:local="*">
>	<fx:Script>
>		
>	</fx:Script>
>	<js:states>
>		<js:State name="LoginState" />
>		<js:State name="DataState"/>
>		<js:State name="DetailsState"/>
>	</js:states>
>	
>	<js:Container id="cData"
>			includeIn="DataState" width="100%" height="100%">
>		<js:beads>
>			<js:VerticalLayout />
>		</js:beads>
>		<js:DataGrid id="dataGrid" width="100%" height="100%"
>className="MyDataGrid" rowHeight="60"
>						 change="onDataGridChangedEvent(event)">
>			<js:beads>
>				<js:DataProviderChangeNotifier sourceID="applicationModel"
>propertyName="dataList" />
>				<js:ConstantBinding
>						sourceID="applicationModel"
>						sourcePropertyName="dataList"
>						destinationPropertyName="dataProvider" />
>			</js:beads>
>			<js:columns>
>				<js:DataGridColumn label="Partition Name" dataField="PartitionName" />
>				<js:DataGridColumn label="Action Description"
>dataField="ActionDescription"/>
>				<js:DataGridColumn label="Action State" dataField="ActionState" />
>				<js:DataGridColumn label="Action Start Time"
>dataField="ActionStartTime"/>
>			</js:columns>
>		</js:DataGrid>
>	</js:Container>	
>		
>	<local:AgentChainDetails id="agentDetails"
>			includeIn="DetailsState" width="100%" height="100%"/>
></js:ViewBase>/
>
>
>Above, /onDataGridChangedEvent()/ injects the ValueObjects to
>AgentChainDetails component after changing application state.
>
>Following is my <fx:Script> section in AgentChainDetails:
>
>/private var _selectedAgent:AgentChain;
>			
>[Bindable("selectedAgentChanged")]
>public function get selectedAgent():AgentChain
>{
>	return _selectedAgent;
>}
>public function set selectedAgent(value:AgentChain):void
>{
>	if (value != _selectedAgent)
>	{
>		_selectedAgent = value;
>		dispatchEvent(new Event("selectedAgentChanged"));
>	}
>}/
>
>While run as HTML, I manually edited 'js-debug/AgentChainDetails.as' and
>added HTML alert in SET selectedAgent method, and I confirm SET
>selectedAgent is calling by adding HTML alert with dummy texts. But the
>alert never fires if I try something ValueObject.field - it looks like
>'value:AgentChain' is coming empty
>
>/Object.defineProperties(AgentChainDetails.prototype, /** @lends
>{AgentChainDetails.prototype} */ {
>/** @export */
>selectedAgent: {
>get: /** @this {AgentChainDetails} */ function() {
>  return this._selectedAgent;
>},
>set: /** @this {AgentChainDetails} */ function(value) {
>alert(value.ActionID); // ActionID is String field
>  if (value != this._selectedAgent) {
>    this._selectedAgent = value;
>    this.dispatchEvent(new
>org.apache.flex.events.Event("selectedAgentChanged"));
>  }
>}}}
>);/
>
>What I'm missing? Please help.
>
>
>
>--
>View this message in context:
>http://apache-flex-users.2333346.n4.nabble.com/Binding-not-works-expectedl
>y-tp12171.html
>Sent from the Apache Flex Users mailing list archive at Nabble.com.

Mime
View raw message