ResetValues doesn't work for component inside DataGrid

UI Components for JSF
Post Reply
sanzios
Posts: 6
Joined: 16 Sep 2011, 13:04

16 Oct 2014, 12:35

Hi

I used PrimeFaces 4.0 and JSF 2.2.5.
I've tried to used resetValues parameter on p:ajax that has update parameter set on p:dataGrid (event is cancel because it is used inside p:inplace component)

Code: Select all

<p:ajax event="cancel" global="false" resetValues="true" update="grid" />

After that there is a nice warn in logs

Code: Select all

Component with ID: XXX:dataGrid:2:YYY. This may occur if you use h:form with prependId=false, as findComponent does not consider it.
After debugging i saw that there is a problem with UIComponentBase.findComponent method that have problem with dataGrid index (XXX:dataGrid:2:YYY). It can't find child element of dataGrid with id "2".

Does anyone has the same problem? Maybe it was fixed in later version of PF (for example use different method to find components by id).

Thanks in advance for help
Last edited by sanzios on 16 Oct 2014, 13:13, edited 1 time in total.
PrimeFaces 4.0
JSF 2.2.5

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

16 Oct 2014, 13:03

try a newer version, we fixed something regarding this.
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

sanzios
Posts: 6
Joined: 16 Sep 2011, 13:04

17 Oct 2014, 09:21

Maybe it would be helpfull for smb.
  • 1. I can't update PF to newer version - not now - probably it will be done in future

    2. I've tried to replace implementation of PrimePartialViewContextFactory in faces-config.xml to override PrimePartialViewContext.resetValues method (add PF 5.0 implementation) but there was a strange error from jquery in every page.

    3. Finally I reset values manually by listener (component is taken from AjaxBehaviorEvent, because it is Inplace I have to iterate over the children)

    Code: Select all

    <p:ajax event="cancel" global="false" process="@this inplace" immediate="true" listener="#{controller.onInlineEditCancel}" />
    

    Code: Select all

    public void onInlineEditCancel(AjaxBehaviorEvent event) {
    		UIComponent parent = event.getComponent();
    		resetValueForEditableValueHolder(parent);
    		for (UIComponent uic : parent.getChildren()) {
    			resetValueForEditableValueHolder(uic);
    		}
    	}
    
    private void resetValueForEditableValueHolder(UIComponent uic) {
    		if (uic instanceof EditableValueHolder) {
    			EditableValueHolder evh = (EditableValueHolder) uic;
    			evh.resetValue();
    		}
    	}
    
PrimeFaces 4.0
JSF 2.2.5

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

17 Oct 2014, 09:46

sanzios wrote:1. I can't update PF to newer version - not now - probably it will be done in future
Thomas said try ;-) not fully update your app. Just to confirm it does not happen in a newer version. And yes, updating is not always possible.

But... Compliments for you next steps. Few people (at least ones that post here) try those kinds of things. Thanks for that and for reporting back

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 40 guests