function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Frank N.Frank N. 

Ajax issue: page changes only small portion but in debug shows it loads the entire page.

HI all,

 

I have another AJAX related question. If I use Ajax to render my page, for example using the following action to add stuff to a basket:

<apex:actionFunction action="{!addProductsToOrder}"	oncomplete="return alert('Order Basket Updated Successfully');" name="updateCartInformation" reRender="jsva">
	<apex:param name="piInfo" value="" />
	<apex:param name="quantity" value="" />
</apex:actionFunction>

 Then the action works, the page does not seem to reload and I see a message on my screen. However, I check the debug log it shows that it renders everything on the page, from top navigation to rendering the entire table in which I have inputfields to add stuff.

 

This does not seem like the appropriate behavior or... ? How can I stop the page from completely reloading and just change one small part of the screen.

 

Best.

Frank

TheSwamiTheSwami

You have rerender="java"  -  what is the element with id="java"?

Frank N.Frank N.

*Update* Using firebug I notice it does return an Ajax response. However, the navigation bar that is causing the big load is still reloaded in debug.

 

JSCA is an outputpanel.

 

<apex:outputPanel id="jsva" rendered="false"></apex:outputPanel>

 

This is the setup on the page, Its the product navigation that seems to be reloading all the time:

 

..snip

<apex:define name="ProductNavigation">
    <c:Collaborate_ProductNavigation key="ProductNavigation" pageController="{!this}" />
</apex:define>

<div class="panes">
  <apex:form >
     <apex:outputPanel id="jsva" rendered="false"></apex:outputPanel>

     <apex:actionFunction action="{!addProductsToOrder}" oncomplete="return alert('Order Basket Updated Successfully');" name="updateCartInformation" reRender="jsva">

       <apex:param name="piInfo" value="" />
       <apex:param name="quantity" value="" />
    </apex:actionFunction>

.. snip

							

 

Function in the codebehind:

 

public void  addProductsToOrder(){
			
		String 	strpitem 		 = Apexpages.currentPage().getParameters().get('piInfo');
		
		Integer productQty 	     = Integer.valueof(ApexPages.currentPage().getParameters().get('quantity'));
		if(productQty >= 1){
			this.basket.add(strpitem,productQty);
		}
		
	}

 

 So no idea why the navigation is reloading. Does the controller get trigger when an Ajax request is made? It does return an Ajax response.. its dubious.

 

Best.

 

 

 

 

Frank N.Frank N.

We have solved this issue. Furthermore we've setup a blog where we discuss our issues and solutions:

 

Three heads on a pike - Salesforce BLOG