1

I have an action function that fires on a select list change:

<apex:selectList label="Select View" id="viewFilter" value="{!viewFilter}" size="1">
      <apex:actionSupport event="onchange" action="{!getCaseList}" reRender="caseListTable"/>
      <apex:selectOption itemValue="all" itemLabel="All" />
      <apex:selectOption itemValue="view1" itemLabel="View 1" />
      <apex:selectOption itemValue="view2" itemLabel="View 2" />
</apex:selectList>

The setter of the binded value adds the new value to the URL param map.

 //controller
 public String viewFilter {get; set{
            ApexPages.currentPage().getParameters().put('viewFilter',value);
            viewFilter = value;
        }
    }

 public void getCaseList(){
        String query = generateQuery();
        caseList = (List<Case>) Database.query(query);
    }

A debug statement confirmed that the setter is firing and it is getting added to the map. However, after the page refreshes, the URL in the browser does not change.

I've tried various different ways of returning from the `getCaseList()':

  • Returning null
  • Returning ApexPages.CurrentPage();
  • Returning new PageReference(ApexPages.CurrentPage().getUrl());

Nothing seems to do the trick. Any ideas?

  • I've added in pageaction and expecting it in postback action. to put it another way, i've added them in one buttonclick and now how to expect them in another click event? I guess, the put's scope only in a given request-to-response. so now tell me how can they show up in url? – user42028 Feb 18 '17 at 0:17
2

I do not think it actually gets added to the URL in the browser window but I bet it is there. If you output and refresh the $CurrentPage.parameters.viewFilter I bet it will show up

<apex:outPutText value="{!$CurrentPage.parameters.viewFilter}" id="theParam"/>

in Addition you can get the parameter in code method as needed to confirm via this:

String tmp = ApexPages.CurrentPage().getParameters().get('viewFilter');
  • Yea it definitely is there... The issue is more of a small usability thing. The client wants to be able to copy the URL and give it to someone else and have the same view load. – NSjonas Jul 22 '15 at 18:52
  • Then you will have to return a whole new URL and redirect the page – Eric Jul 22 '15 at 18:52
  • Yea, I just realized that... It was also putting the viewstate into the URL's so I had to create a new page reference instead of returning "CurrentPage"... Funny how small non-functional requirements can quickly turn your SF solutions into hackish garbage. I think I'm back to the drawing board on this one. – NSjonas Jul 22 '15 at 18:55
  • Related post using JS - stackoverflow.com/questions/10953792/… – Eric Jul 22 '15 at 18:56
  • Nice man! Looks more along the lines of what I need – NSjonas Jul 22 '15 at 19:05

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.