-
Notifications
You must be signed in to change notification settings - Fork 19
Reset EditableValueHolders which are not covered by ajax execute before ajax render #1060
Comments
Reported by @BalusC |
Issue-Links: |
@arjantijms said: See this for another related source: http://community.jboss.org/message/620000 |
@edburns said: |
wrschneider99 said: |
ova2 said: "preserveInputs" "resetInputs" I wanted to say that this should be configurable when will be introduced into the core JSF stuff. In my opinion it's definitely better to use third-party components to achieve this behavior if it's desired. Please don't implement this feature as default behavior in JSF because we will end up then with a third-party component again. In this case with PreserveEditableValues (opposite of ResetEditableValues) Thanks. |
@arjantijms said: I'm not 100% sure for a pressing need for configurability in the AJAX case.
Yet another implementation of a reset listener: ResetInputAjaxActionListener.java With quite a few implementations of the same concept out there and a recurring number of questions on this topic at e.g. the PrimeFaces forum and StackOverflow, I hope this can be considered for standardization. |
ova2 said: Thanks for your reply. Saidly, but the default behavior, you described, doesn't satisfy all use cases. Imagine a component like PrimeFaces Wizard or PrimeFaces Extensions MasterDetail (you already know them). They render itself. Imagine <h:panelGroup id="rootElement"> span / div element with id="rootElement" gets re-rendered while masks are switched. All UI masks are placed below the element with id="rootElement". You don't even need any wizard like components. You can just include masks dynamically via <ui:include src="# {myBean.currentMaskPath} "/> and re-render <h:panelGroup id="rootElement">. Now imagine you have a select box in a mask "ABC" and want to show details to any selected item by click on one small icon next to the select box. Detail infos are placed in the mask "XYZ". You have to change masks, that means re-render the root element above. Right? But you want to be able to go back from the mask "XYZ" to the "ABC" and see your last input values. Last input values in the mask "ABC" should not go lost during switching (we have e.g. templates with 100+ fields). And what now? You can not switch masks by f:ajax process="rootElement" because if validation fails you can't go to the next mask. Validation should be ignored in this case. You can't switch masks by f:ajax process="@none" because input values will not be saved as submitted values. You should use immediate="true". immediate="true" allows to skip validation and preserve last input values. You see, we re-render and process an area and all values inside of this area should not be reseted. This was one use case. By another use case when you save the current mask, the same area gets re-rendered and processed again, but all values inside of this area should be reseted. I hope I could describe the problem understandable. Thanks. P.S. By the way, in your ResetInputAjaxActionListener.java if you visit all components with visitTree in order to find editable value holders, reject visiting for not rendered components first. Something like if (!target.isRendered()) { return VisitResult.REJECT; } I have a big experience with such kind of reseting. We figured out that if you have a DataTable with rendered="false" and you visit it, it's value gets evaluated - all DataTable rows are re-evaluated during iteration. This behavior has a big impact on performance. Not rendered components are not needed to be visited. Good luck. |
@BalusC said: |
ova2 said: |
kito75 said: |
@BalusC said: |
Marked as duplicate on Monday, November 5th 2012, 8:17:56 pm |
This issue was imported from java.net JIRA JAVASERVERFACES_SPEC_PUBLIC-1060 |
Background:
Problems:
Enhancement request:
Affected Versions
[2.0]
The text was updated successfully, but these errors were encountered: