using javascript to do ajax update

UI Components for JSF
Post Reply
snotmare
Posts: 6
Joined: 01 Sep 2011, 19:21

02 Sep 2011, 22:00

Greetings!

I've got a p:commandButton that executes a task and returns a success code. My commandButton includes this line of code:

Code: Select all

oncomplete="handleSaveRequest(xhr, status, args)"
In my javascript handleSaveRequest function, I would like to conditionally update other components on the page. So, instead of listing the components in the update attribute of my button like this...

Code: Select all

update="panel1, panel2"
I would like to do something like this in my javascript function...

Code: Select all

function handleSaveAircraftRequest(xhr, status, args) {
	if(args.success) {
		//update panel1
	}else{
		//update panel2
	}//if
}//handleSaveAircraftRequest
</script>
My attempts to do this have failed so far. Here's the latest thing I've tried...

Code: Select all

PrimeFaces.ajax.AjaxRequest('/myPage.jsf',{
	source:'form',
	update:'table1'
});
Does anyone know of a way to accomplish this? Many thanks for your help!

snotmare
Posts: 6
Joined: 01 Sep 2011, 19:21

07 Sep 2011, 16:03

Hey all, does anyone have an idea on this? Any help would be appreciated!

User avatar
Oleg
Expert Member
Posts: 3805
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

07 Sep 2011, 16:57

Hi,

Try p:remoteCommand. That's exactly what you want.
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 21 guests