Anyone know how to pass a selectList inside a apexBlockTable to choice multiple SelectOptions with individual list of versions by specific product name. there are a VF and the controller method below any ideas?
PS: Please see the screenshot below for more information
The controller code:
public list<SelectOption> getVersionList(string pProductSeperatebyAssets) {
list<Product2> products = new list<Product2>();
list<Product_Version__c> versionsbyProd = new list<Product_Version__c>();
for (WrapAsset asset : selectedWrapperList) {
products.add(asset.asset.Product2);
}
versionsbyProd = [select Id, Name, Product__c from Product_Version__c where Name =:pProductSeperatebyAssets];
system.debug('products: '+products);
system.debug('versionsbyProd: '+versionsbyProd);
List<SelectOption> versions = new List<SelectOption>();
//versions.add(new SelectOption('', '-----None-----'));
if (selectedWrapperList != null) {
for (Product_Version__c v:versionsbyProd) {
versions.add(new SelectOption(v.Id, v.Name));
}
}
options = new list<SelectOption>(versions);
system.debug('options: '+options);
return versions;
}
public string choice {get; set;}
public string getChoiceVersion() {
for (SelectOption so : getVersionList()){
if (so.getLabel() == choice){
return so.getLabel();
}
}
return null;
}
list<string> choiceVersionList = new list<string>();
public String getChoice() {
return choice;
}
public Id getVersion() {
return this.version;
}
The visualPage code:
<apex:pageBlockSection title="You Selected" columns="1">
<apex:pageBlockTable value="{!selectedWrapperList}" var="asset" onRowClick="show(this);" >
<apex:column headerValue="Asset Name" value="{!asset.asset.Name}" />
<apex:column headerValue="Product Name" value="{!asset.asset.Product2.Name}" />
<apex:column headerValue="Original Version" value="{!asset.asset.Product_Version_2__c}" />
<apex:column headerValue="Cloned Versions">
<apex:actionRegion >
<apex:selectList size="1" multiselect="false">
<apex:selectOptions value="{!VersionList(asset.asset.Product2.Name)}"/>
<apex:actionFunction name="choice" action="{!getChoiceVersion}">
<apex:param value="{!getChoiceVersion}" name="degreeSelected" assignTo="{!choice}" />
</apex:actionFunction>
</apex:selectList>
</apex:actionRegion>
</apex:column>
<apex:column headerValue="Status" value="{!asset.asset.Status}" />
</apex:pageBlockTable>
</apex:pageBlockSection>
Passing a parameter to the controller VersionList() function I am getting this error message: Compile Error for AssetProduct_ManualClone_ResultPage.page: Unknown function VersionList. Check spelling. at line None column None
SelectOption
attribute list inside myWrapAsset
class the easy way to pass specific list of versions to my Cloned Versions column.