Flex 3 using nested states - flex3

Im using states in my flex form application.
The base state is the regular form. I then have an advanced form button which calls the advanced state. Once inside the advanced state form if a user enters invalid data an error will be displayed using another error state which just adds a text field to the lastChild element of the advanced state,
the problem im having is that when the error state is kicked off, instead of displaying the error below the advanced form it instead goes back to the base state.
Is it possible to calls a state from inside another state?

I'm not familiar with states, but judging from the documentation, isn't that what the basedOn attribute of the State object is for?

you can check out the flex states tutorial here :
http://askmeflash.com/tutorial/0/how-to-create-website-in-flex-tutorial-my-first-flex-website

Related

How to change the bottom tab icon dinamically in React Navigation

I would like to know if it's possible to change the bottom tab icon dynamically, I mean, I'm interested to change one of the tab icons when an event occurs...
I have read the documentation but couldn't find any related info about it...
The only solution that I can think of is using a global store variable to control it when it's defined in the bottom tab navigation, using a solution similar to what react-navigation docs proposes here.
I would also think of using a global state management API such as Context API (https://reactjs.org/docs/context.html#dynamic-context), redux (https://redux.js.org/tutorials/quick-start), recoil (https://recoiljs.org/docs/introduction/installation/), etc.
and then set the global state variable on event handler, as well as in the ternary operator in the react-navigation example you provided (in the place
of "focused")

The best way of Two-way data binding using vuex in a list

I have a list of items in a Vuex state.
According to the image when I checked items the main state would be updated using v-on:change
and too in the sidebar but when I toggle down using v-on:change (side bar) the Vuex state changes but the checkbox has value!!!
how to handle it using two-way data binding in such a scenario?
best regards.
I have the main list in the whole of programs with contains such items:
{id:1,text:'a',checked:false}
this scenario :
the Search component shows pure of list items either checked or not checked.
the Side Component shows the items checked properly and then click the close button it should disappear and uncheck items simultaneously.
so Search Component bind to the list by :
<input type="checkbox" :value="item.checked" v-model="$store.state.sideBarItems[index].checked">
so my answer is [index].checked which make a proper two-way data binding.
tnx to this post which gives me an idea

Vuejs Hide/Show Elements refreshes when Routes change

I have been developing a Vue project and something caught my attention today. I used checkboxes with some sytling (I use them as toggle switches) throughout the project and thanks to these elements, I show or hide some elements and components. Toggle elements control specific data within each component. When the data istrue, some elements are displayed on the page and when false, they are hidden. What I noticed today is a little interesting. There is probably a simple solution, but although I have been searching the internet for a while, I haven't found a solution yet.
Here is the thing;
Let's say I am at the About page of my project. I used my toggle switches and now some of my elements and some sub components are displaying in the About.vue. Then I go and visit my Services.vue page and showing and hiding some elements and sub components as well. By the way, almost all of these pages have forms and I save these forms to local storage. When I return to My About page from my Services page, I see that the elements I activated have been restored. In other words, each component welcomes me with its default state when it is returned from another component. What I want to see is, If I go and check some checkboxes to show some element, No matter how long I roam between other routes, I want those elements to remain visible or hidden when I come back. For example, a toggle element must be activated to write a username and password on a component. After activating the toggle element, the user types the username and password and clicks the Save button. Then he continues to browse many areas of the project and when he returns, he sees that the toggle element is inactive and the username and password are not entered. I don't want it to be that way. How do I fix this?
you can use vuex for solved this problem.
https://vuex.vuejs.org/
Vuex is a state management pattern + library for Vue.js applications. It serves as a centralized store for all the components in an application, with rules ensuring that the state can only be mutated in a predictable fashion. It also integrates with Vue's official devtools extension (opens new window)to provide advanced features such as zero-config time-travel debugging and state snapshot export / import.

Vuejs: shared states between components

I would like to know the best practice for implementing shared states between components in Vuejs.
Imagine situation A: you have a web app that shows a modal. The modal has the boolean state show. This state should change if the modal OK-button is clicked, but also if any part of the background is clicked, and perhaps even on some server pushed state change. Thus the modal should be able to change the state as should the parent app.
Situation B: you have a web app that shows input fields inside different components that share a common data value. If the user changes value through the field in one component, it should also update in the other. Again both should even update on a server push event.
Questions:
I am right that the correct way to go about this would be to use vuex and make the shared state a store field that is observed by and changed through emitted actions by all components / parents that need to modify that value?
Does that not introduce this kind of dangerous (since hard to handle) magic reactivity that we know from Meteor?
How to best document the flow, what depends on what?
A: For a modal component, I'd say that show should be a prop. So the parent component can control the modal whatever it wants. In this case there is no shared state at all.
The modal itself doesn't need to know anything about the server. If the prop show is true, just display the modal and vice versa.
I think the mask layer is a part of the modal, so when the mask is clicked, the modal emits an event. The parent component receives the event and can decide to hide the modal or not to.
Vue has an official modal example here (thanks #craig_h for mentioning): https://v2.vuejs.org/v2/examples/modal.html
B: Just bind the vuex state to the inputs. Nothing wrong.
Note that not all the components need to access the vuex store directly. For some pure UI components, just use props. So the parent components have the right to control them and increase flexibility.
I recommend you to read these docs:
https://facebook.github.io/react/docs/lifting-state-up.html
https://medium.com/#dan_abramov/smart-and-dumb-components-7ca2f9a7c7d0#.j7ry4a3as
http://redux.js.org/docs/basics/UsageWithReact.html
Yes these are React / Redux docs. Since Vue is relatively young, react community has more documentation / articles. But both Vue and React are component-based libraries. The idea of how you design a component is basically the same.
You can also take a look at this vuex example: https://github.com/vuejs/vuex/tree/dev/examples/chat
This is a very simple example but it does use all the things I mentioned above. Emitting an event, some pure UI components...

xpages view picklist custom control

I am using mark t hughes view picklist custom control from open NTF.
Link to control on openNTF
I have set all the paramenters etc, however when I load the page with the control on, I get my custom error page, and the error below in my error logging database
Error on dialog1button5999 null property/event:
1:
Script interpreter error, line=1, col=35: [ReferenceError]
'compositeData' not found
compositeData.picklistButtonClass + " domfindmebutton5999"
This is trying to set the styleClass of a button in the custom control here:
<xp:this.styleClass><![CDATA[#{javascript:compositeData.picklistButtonClass + " domfindmebutton5999"}]]></xp:this.styleClass>
I am also definately passing this parameter is with the default code:
picklistButtonClass="button2"
I also followed the video Here to the letter, and still get exactly the same issue.
Has anyone come across this before or have any pointers as to where I should be looking to resolve it? Im not sure where to start, as all the instructions and video's explain how to complete the custom properties of the control, but there is never any mention of a need to actually modify any code WITHIN the custom control....
Thanks
(as a side note, I am using bootstrap, should this make any difference)
This is because of the theme definition. Look at the Mark Leusink's blog entry here. http://linqed.eu/2014/08/28/xpages-gotcha-modeconcat-in-your-themes/
If a theme has a "concat" definition, that will be computed at a very early phase. To concat values, it needs to compute the initial value. However, in some cases (e.g. Repeat, Custom control, etc.), the initial value cannot be computed at the page-load section.
For such cases, you can override the theme with a special themeId, as Mark suggested.