I am trying to update an Apex:repeat section with new values returned from the controller.

I have a JS remote call connected to a to refine my search qry This works and returns fine.

However i cannot Rerender or update the list to pass new values down to the component.

The JS Remote gets values from other parts of the page Via Jquery

Any help would be welcome


     <div class="refine_search-btn">
      <button type="button" class="btn btn-refine" onclick="refineSearch()" ><i><img src="{!URLFOR($Resource.WebImages,'search.png')}"/></i>Refine search</button>

    <apex:form id="form">

        <div class="adv_dealslist svr_model" id="theDealRepeater">
        <apex:actionFunction name="reRenderDeals" rerender="theRepeat" />

          <apex:repeat value="{!AllDer}" var="deal" id="theRepeat">
                <div class="replaceTarget">
                    <c:dealListCmp DealObject="{!deal}" />

function refineSearch(){


            var selectedBodyTypes = new Array();

            // Get BodyType

            // Get Trim Level Selected
            var trimSelected = $("#trimLevel option:selected").text();
            //get GearBox Selected
            var gearBoxSelected = $("#gearBox option:selected").text();

            //get FuelSelected
            var FuelSelected = $("#FuelType option:selected").text();

            // Remote action call to controller
                function(result, event){


                    $("#NumberOfDeals").text(result.length + " Deals Found");


                    } else if(event.type ==='exception'){
                        alert("We had a boo boo " + event.message);
                    } else {
                        alert("something odd happened " + event.message); 


public List<public_tblderivative_base__x> AllDer = new List<public_tblderivative_base__x>();

    public static List<public_tblderivative_base__x> testRemoteCall(List<String> bodytypes, String Trim, String gearBox, String Fuel){
        System.debug('Value 1 ' + bodytypes);
        System.debug('Value 2 ' + Trim);
        System.debug('Value 3 ' + gearBox);
        System.debug('Value 4 ' + Fuel);

        List<public_tblderivative_base__x> theResult = getAllModels(manufactorCode, rangeCode, bodytypes, Trim, gearBox, Fuel);
        new searchModelController().setAllDer(theResult);
        return theResult;

public List<public_tblderivative_base__x> getAllDer(){
        // Limit this to 10 for now.

        List<public_tblderivative_base__x> theReturn = new List<public_tblderivative_base__x>();
        Integer count = 5;
        //System.debug('Getting Deals ' + getAllDer());

        if(AllDer.size() < 5){
            count = AllDer.size();
        for(Integer i = 0; i < count; i++) {
            System.debug('In for loop');

        return theReturn;

Found the Answer:

VisualForce needed changing so that the actionFunction took params, As well as a action call to a new method within the controller

<apex:actionFunction action="{!actionCallToResetList}" name="reRenderDeals" reRender="reRenderThis">
        <apex:param id="Trim" name="Trim" value="" />

Also the Repeat needed a wrapper of a outputPanel.

This then aloud the JS call to take a param taken from the Jquery call earler.


In the controller the new method then needed to get the param from the current page and reset the List that will be returned.

public void actionCallToResetList(){
        string Trim = Apexpages.currentPage().getParameters().get('Trim');
        System.debug('*Value 2 ' + Trim); 

         AllDer = getAllModels(manufactorCode, rangeCode, null, Trim, null, null);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.