+ Start a Discussion

apex:actionSupport event="onchange" reload the page when we call method....

Dear Friends,

I have jquery fullcalendar plugin attched to my VF page, I have select list in the top which has locations, when user select location then it calls apex method and displays the event related to location. I have a problem here, when they change the location, it reloads the page and the calendar view goes back to week view to month view. Can you guys suggest me the way we can update the calendar events without loading the entire page..

Full Calendat ref link : http://fullcalendar.io/

Rajiv Penagonda 12Rajiv Penagonda 12
Venkat, without getting a look into your code it is hard to provide suggestions. However, based on the definition which you have provided, I am assuming that you are using an action function or a command button to do page reload when user selects a location which is resulting in your entire page reload. If this is the case, I suggest that you go with a javascript remoting feature of salesforce. Refer an example here (https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_js_remoting_example.htm).

When it does is that instead of making a call to your controller method directly, you can access the feature from your javascript and refresh information on the calendar through javascript.

Hope this helps.
Mahesh DMahesh D
Hi Venkat,

Please find the below example:

<apex:page controller="sample" id="mypage">
    <apex:form >            
        <apex:selectList id="selected_list" value="{!temp}" required="false" size="1">
            <apex:selectOption itemvalue="None" itemLabel="--None--"/>
            <apex:selectOption itemvalue="a" itemLabel="a"/>
            <apex:selectOption itemvalue="b" itemLabel="b"/>
            <apex:actionSupport event="onchange" reRender="Details" action="{!find}"/>
        <apex:panelGroup >        
            <apex:outputPanel id="Details">            
                The value based on select list value: {!temp1}            

Apex Class:
public class sample 
    public String temp {get; set;}
    public String temp1 {get; set;}

    public sample() 

    public void find()
        if(temp == 'a')
            temp1 = 'Welcome';
        else if(temp == 'b')
            temp1 = 'Thank you';

Also go through the below links:








Please do let me know if it helps you.


Thanks lot for your reponse on this. I did try both and didnt work. I am able to get the current calendat view using java script. how can we pâss that current view to Apex controller...

Hi Venkat

Once your page load you need to call the below mentioned script
$('#calendar').fullCalendar({ defaultView: 'month' aspectRatio: 1.5 });

This will help you bring back to month view.
Please let me know if this works for you:)

bydefault it goes to month view only after the page reloads after apex method called.