You need to sign in to do that
Don't have an account?
Basskoff
How to get selected items from enhancedList?
Hello,
I'm having a deal with enhancedList component.
I cannot figure out how to get selected items from there.
I've tried to do it like for selectList but it doesn't work.
Please advise how to access selected items in enhancedList from controller.
Any suggestions would be appreciated.
Thanks.
see example:
<apex:page controller="sampleCon">
<apex:form>
<apex:selectList value="{!countries}" multiselect="true">
<apex:selectOptions value="{!items}"/>
</apex:selectList><p/>
<apex:commandButton value="Test" action="{!test}" rerender="out" status="status"/>
</apex:form>
<apex:outputPanel id="out">
<apex:actionstatus id="status" startText="testing...">
<apex:facet name="stop">
297
Standard Component Reference apex:selectList
<apex:outputPanel>
<p>You have selected:</p>
<apex:dataList value="{!countries}" var="c">{!c}</apex:dataList>
</apex:outputPanel>
</apex:facet>
</apex:actionstatus>
</apex:outputPanel>
</apex:page>
/*** Controller: ***/
public class sampleCon {
String[] countries = new String[]{};
public PageReference test() {
return null;
}
public List<SelectOption> getItems() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('US','US'));
options.add(new SelectOption('CANADA','Canada'));
options.add(new SelectOption('MEXICO','Mexico'));
return options;
}
public String[] getCountries() {
return countries;
}
public void setCountries(String[] countries) {
this.countries = countries;
}
use system.debug to understand the code logic.
use outputlevel tag in VF page and see the output.
This is an example for selectList from guide, not for enhancedList.
This approach doesn't seem to be working with enhancedList.
So is this not possible?