Force re-evaluation of rendered property on JSF component - ajax

In my application, I have a phaselistener that can conditionally hide a component by setting UIComponent.setRendered(false) .
On that page, I have ajax tabs, with tab one able to influence the display of the other. So, I go to a tab, change something, come back, but there I find that the component still remembers it's unrendered state.
I guess not doing ajax for my tab navigation would solve this, but is there any other way that I can somehow force the component tree to be build up as if it was the first time?

Related

Angular Material md-select load options in async way

I need to load select's options asynchronously (
through a service), using the Angular Material md-select component.
Actually, I use a click event to load data. It works but I need to click the select twice to show the options. That it's a problem.
The expected behavior is shown at this link (AngularJs Material)
The actual behavior is shown at this link.
Is Async options' loading supported by md-select?
The reason you need to click twice is because when you first click, there are no options in the select control and so it doesn't try and open the panel. Then your async method loads the options into the DOM and on the next click it will open.
In order to deal with this, you must always include at least one <mat-option> in your <mat-select>. You can add a disabled <mat-option> with a <mat-spinner> showing that the data is loading for example.
Here the most simple example of that. This is not the best approach... see below.
However, this still uses the click event which isn't the best approach. If you put the click event on the <mat-select> there are spots where you can click on the control but your click event wont trigger even though the dropdown panel still opens (places like the floating label area). You could put the click event on the <mat-form-field> but then there will be places where you can click and trigger the click event but the dropdown panel wont open (places like the hint/error text area). In both cases you lose keyboard support.
I would suggest using the <mat-select> openChanged event instead of a click event. This has its own quirks too but they are manageable.
Here is an example using the openChanged event. I also made the component more robust overall.
I also made a version that uses the placeholder element to show the spinner instead of using a disabled mat-option. This required View Encapsulation to be turned off.
Note: In my example, the service can return different data depending on the circumstances. To simulate this my fake service keeps track of how many requests you send it and changes the options returned accordingly. So I have to set the option list back to empty and clear the formControl's value every time the list is opened. I save the selected value before clearing the formControl so that if the service returns a list with the same item I can automatically reselect the value. If you only need to load the options once, then you would want to modify the code a bit to only load the options the first time the user opens the select.

How to force the back button to show on title bar?

Here's the scenario:
I'm working with Xamarin forms and using FreshMVVM.
My main screen is a FreshTabbedFONavigationContainer, one of the tabs navigate deeper into other pages while the others don't. If I'm in one of those deeper pages and do:
CoreMethods.PushNewNavigationServiceModal(...)
the next navigation page is added to the stack and the back button appears and works fine.
But if I call the same method from a root page in my main tabs page, the back button doesn't appear. I'm calling the same method, the same way, with the same argument types. I've even tried the same arguments.
Why would it work from a deeper FreshBasePageModel and not from the first FreshBasePageModel in a FreshTabbedFONavigationContainer? I've tried FreshTabbedNavigationContainer too and it made no difference.
Also, is there a way to force the back button to show and manage its behavior?

Don't rerender a control

Is there a way to tell a control, that it shouldn't rerender? Because in my component, there is a view, which dynamically adds messages to a dialog. Everytime I search for a letter in the searchfield, the view is refreshed to show the results. So after every refresh, the searchField is empty. This shouldn't happen.
EDIT: The problem is solved. Maybe another got the same problem, I've set Modelbinding and rerendered the SearchField, now it works. So the problem was not that it renders everything, the problem was, that the SearchField was not rendered ;)

AjaxFormValidatingBehavior Performance and Lost focus on Firefox

My project is using Wicket's AjaxFormValidatingBehavior to auto-save form content to Session on sort of a multi-tab form with a tree menu (there is no save button on individual tabs, though there is a "Save" button that actually submits the form, runs the validations and saves contents to database). I am facing few issues:
Since the behavior is added to all form components' onChange event, there is a server-trip every time user moves from one field to another. I know that a throttle duration can be specified to prevent this, but its not possible to set in my case as my forms are of different lengths/complexity, many components dynamically generated (including the tree menu). But is there a more elegant solution to auto-save form content (that doesn't have a submit button) rather than this annoying solution.
Another issue I am facing is that post onChange event, on Firefox the component loses its focus after the "server trip" ends. While on IE7 it works fine.
For the first question I think you need to add a pipelining facility, on your components' onchange call a javascript function of your which calls your webapp. You can include a feature similar to the one provided with the throttle duration but page-wide (delay each calls and only trigger the last if it is older than x milliseconds for example).
For the second one, I think you have to use the AjaxRequestTarget#focusComponent in your behaviors, or handle this thing in your "wrapper" as described in the first answer.

SL3 dataform validation indicators don't show in tab pages

I have a Prism/SL3 application with a tab control and each page of the tab control is a "Region" that has its own view and viewModel. when I want to validate the main page, I call dataForm.ValidateItem(), then I go to all the child views and do the same. the problem is, only the pages which user has clicked on them (on the tab page), get instantiated and the pages that are never shown, don't have their view instantiated, thus I can't validate them.
any help?
I created a psuedo work around for this. It's very hacky, but it does work. My example involved walking the visual tree (up and down) to find respective controls that are invalid and then "expanding" the selected item. I have used an accordian in my example, but have also tested this with tab:
http://thoughtjelly.wordpress.com/2009/09/24/walking-the-xaml-visualtree-to-find-a-parent-of-type-t/
HTH,
Mark
EDIT: Link updated.

Resources