• santol
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

In my component I use actionfunction and rerender

<apex:component controller="MultiSelectBoxController">
	...	
	<apex:panelGrid columns="4">
		...
		<apex:actionFunction name="moveDown" action="{!moveDown}" reRender="selectedRight"/> 
		
		...
	
	    <apex:selectList id="selectedRight" required="false" value="{!selectedRight}" multiselect="true" size="20" style="width:250px">
	        <apex:selectOptions value="{!rightOptions}"/> 
	    </apex:selectList>
	
	    <apex:panelGroup layout="block" style="text-align: center; padding:10px;">
	        Up<br/>
	        <a href="javascript&colon;moveUp();" style="text-decoration:none">
	            <img src="/s.gif" alt="Move Up" class="upArrowIcon" title="Move Up"/>
	        </a><br/>
	        ...
	    </apex:panelGroup>
	</apex:panelGrid>

</apex:component>

By debuging I am sure that my action method is called correctly

 

public class MultiSelectBoxController {

	...
	
	public PageReference moveDown() {
		// For each selected item right
		for(Integer r=0; r<selectedRight.size(); r++) {
			
			// Iterate over right list
			for(Integer pos=rightOptions.size()-2; pos >=0; pos--) {
				// When select item is found 
				if(rightOptions[pos].getValue() == selectedRight[r]) {
					// Save item above
					SelectOption tmp = rightOptions[pos+1];
					// Switch options with item above
					rightOptions[pos+1] = rightOptions[pos];
					rightOptions[pos] = tmp;
				}
			}
		} 
		return null; 
	}
}

 Even in Firebug I can see the AJAX POST request coming from the rerender. But on the page nothing happens although the rightOptions have changed...

 

After an hour of trial and error I hand this over to someone whos smarter than me....

 

Robert