-1

I try to update my schedule after bean validation complete and hide dialog but it is not working.Hide dialog it is ok but not update.

<p:commandButton id="addButton" value="Save" 
actionListener="#{planningController.addEvent}" 
oncomplete="if (!args.validationFailed){PF('eventDialog').hide(); PF('schedule').update();}"/>
</p:commandButton>
mstzn
  • 2,462
  • 2
  • 19
  • 32
syca
  • 13
  • 1
  • 6
  • Show us your update function. did you see any errors in console? – Koti Panga Oct 23 '14 at 22:38
  • Hi, i don't have a personalised update function, it's just to refresh the schedule. If i use only PF('schedule').update(); without hide function, it work fine. No error in console. – syca Oct 24 '14 at 06:42
  • In this case you could try to create a function which holds your two calls : `function completed() { PF('eventDialog').hide(); PF('schedule').update(); }` and use it in `oncomplete="if (!args.validationFailed){ completed(); }"` – Thrax Oct 24 '14 at 07:10
  • Yes it was a good idee but not working :/ . Finally i'm not sure that PF('schedule').update() work proprely .. May be i can use somthing like that "RequestContext.getCurrentInstance().update" in my listener ? But i don't know ... – syca Oct 24 '14 at 11:28
  • If you are just trying to refresh your view, you could either call an ajax in your `oncomplete` or you could redirect the user on a view (same one if needed) in your bean's action. – Thrax Oct 24 '14 at 12:45

1 Answers1

0

Finally i use javascript function :

function completed() { PF('eventDialog').hide(); PF('schedule').update(); }

and call with oncomplete.

If not working is because i need to place my script into my template juste before to close body i don't know why it doesn't work in other xhtml but now working.

THanks a lot to all.

syca
  • 13
  • 1
  • 6