Hi Brian, is double binding working?
thanks El mar, 16 feb 2021 a las 22:11, Maria Jose Esteve (<[email protected]>) escribió: > Double binding? she hadn't thought about it ... > > I will try it. Thanks Brian. > > > > Hiedra. > > > > *De:* Brian Raymes <[email protected]> > *Enviado el:* sábado, 13 de febrero de 2021 20:04 > *Para:* [email protected] > *Asunto:* RE: [EXTERNAL] Crux - binding model between views > > > > You might be missing either of the following: > > One way binding: > > > > [*Bindable*] > > [*Inject*(source="customerModel", bind="true")] > > *public* *var* customerModel:CustomerModel; > > > > Two way binding: > > > > [*Bindable*] > > [*Inject*(source="customerModel", twoWay="true")] > > *public* *var* customerModel:CustomerModel; > > > > Brian > > > > *From:* Maria Jose Esteve <[email protected]> > *Sent:* Wednesday, February 10, 2021 5:25 AM > *To:* [email protected] > *Subject:* [EXTERNAL] Crux - binding model between views > > > > Hi, let's see if someone can help me or give me some clue to follow. > > In the application in which I am working there are many maintenance, mvc, > whose management is identical. We have created a component SectionContent, > ModuleSectionContent.as, with the idea of encapsulating in it all the > processes and / or common components (navigation between the records, > detail view-list view, toolbars according to the edition status, ...). In > this template, for example, we add a header (mxml component) as a "Toolbar" > that, as you can imagine, will need a bindable reference to the "model" > that is assigned to the component and, at this point, is WHERE I NEED HELP: > I can't make the automatic binding of the model work, from the main view to > the header. (Everything works perfectly if I create a set in the template > and hence a call to the bindable set of the header subcomponent) > > > > We use crux and all the models implement the same interface, > IModelArqManager; currently this is the implementation: > > > > Component “*ModuleSectionContent.as*” (Template) > > > > [*Bindable*] > > *public* *class* ModuleSectionContent *extends* SectionContent > > { > > … > > *public* *var* header:HeaderModule = *new* HeaderModule(); > > … > > *public* *function* *set* isOnAddingMode(value:Boolean):void { > header.isOnAddingMode = value; } > > … > > > > Componente “*HeaderModule.mxml*” (var header) > > > > <?xml* version*="1.0"* encoding*="utf-8"?> > > <j:Grid > > *xmlns:fx*=http://ns.adobe.com/mxml/2009 > > … > > *private* *var* _isOnAddingMode:Boolean; > > [*Bindable*] > > *public* *function* *get* isOnAddingMode():Boolean{ *return* > _isOnAddingMode;} > > *public* *function* *set* isOnAddingMode(value:Boolean):void > { _isOnAddingMode = value;} > > … > > <j:IconButton *localId*="tbProc" *unboxed*="true" *emphasis*="emphasized"> > > <j:icon> > > <js:FontAwesomeIcon *text*= > "{(isOnAddingMode) ? FontAwesome5IconType.PLUS_CIRCLE : 'edit'}" > > *relativeSize*="{FontAwesomeIcon.SIZE_LG}" *faStyle*= > "{FontAwesomeIcon.DUOTONE}" /> > > </j:icon> > > </j:IconButton > > > … > > > > > > Implementation, example, *CustomerView.mxml*: > > > > <?xml* version*="1.0"* encoding*="utf-8"?> > > <views:ModuleSectionContent > > *xmlns:fx*="http://ns.adobe.com/mxml/2009" > > *xmlns:j*="library://ns.apache.org/royale/jewel" > > … > > *isOnAddingMode*= > "{customerModel.currentState == UtilConstants.STATE_ADDING}" > > > > > <fx:Script> > > <![CDATA[ > > … > > [*Bindable*] > > [*Inject*(source="customerModel", required="true")] > > *public* *var* customerModel:CustomerModel; *//Implement > IModelArqManager* > > … > > > > What I am trying to do is remove the "set isOnAddingMode" function from > the ModuleSectionContent.as template, and the setters mapped in the > CustomerView.mxml tag (we have about 20-25 binda variables similar to > isOnAddingMode) > > Can be done? > > I have had relative success injecting the customerModel as an interface > but binding is not working for me. > > > > Any suggestion? > > > > Thx. > > Hiedra. > > > > > > > -- Carlos Rovira Apache Member & Apache Royale PMC *Apache Software Foundation* http://about.me/carlosrovira
