You need to sign in to do that
Don't have an account?

How to show the two different object picklist values in Pageblock table
Hi Friends
I have developed one visual force page. One page block have Two pageBlock Sections, That Pageblock sections have two picklist. Two different object values has reterived in the picklist values. i would like to show these values in one Pageblocktable. its possible. Please let me know yours suggestions..
Visual Force page
<apex:pageBlock title="Inventory Line Item" >
<apex:pageBlockSection title="" >
<apex:pageBlockSectionItem >
<apex:outputLabel value="Inward ILI" for="item1" style="font-weight:bold" />
<apex:selectList value="{!InwardILI}" multiselect="false" size="1" onselect="show" id="sellist1" >
<apex:selectOptions value="{!ILIitems}"/>
<apex:actionSupport event="onchange" reRender="Pallet" status="..."/>
</apex:selectList>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Pallet Id" for="item1" style="font-weight:bold" />
<apex:selectList value="{!Invplist}" multiselect="false" size="1" onselect="show" id="Pallet" >
<apex:selectOptions value="{!Invpitems}"/>
</apex:selectList>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:commandButton style="" value="Add Line Items" action="{!AddInventoryPallet}" />
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
Controller:
*/ Two picklist values */
public List<SelectOption> getILIitems() {
List<selectoption>selectILI = new List<Selectoption>();
List<ILI__c>InwardILIlist = new List<ILI__c>();
InwardILIlist = [Select Id,Name,Product__c From ILI__c where Direction__c='Inward'and Product__c =:ProductName];
System.debug('::InwardILIlist::'+InwardILIlist);
selectILI .add(new SelectOption('-Select-','-Select-'));
for(ILI__c ili: InwardILIlist ){
selectILI.add(new SelectOption(ili.Id,ili.Name));
}
System.debug('::SelectILI::'+selectILI);
return selectILI ;
}
public List<SelectOption> getInvpitems() {
List<selectoption>selectInvpallet = new List<Selectoption>();
List<Inventory_Pallet__c>inventorypalletlist = new List<Inventory_Pallet__c>();
inventorypalletlist = [
Select Id,Name From Inventory_Pallet__c
where Inventory_Line_Item__c =:InwardILI and Status__c='Inward'];
System.debug('::inventorypalletlist'+inventorypalletlist);
selectInvpallet.add(new SelectOption('-Select-','-Select-'));
for(Inventory_Pallet__c invp: inventorypalletlist ){
selectInvpallet.add(new SelectOption(invp.id,invp.Name));
}
return selectInvpallet;
}
Thanks
Sundar
You should be able to compress these into a single pageblocksectionitem by surrounding them both with an outputPanel.
Something like:
All Answers
Can you clarify your requirements a little? The pageblocktable component iterates a list of objects and typically outputs the fields/properties on those objects. Are you looking to iterate the select options and produce some kind of side by side comparison?
Hi bob
My requirements is if i select one ILI from the First Picklist ,Respective selected ILI pallet will be displayed in the second picklist. the Two picklist have in two section items. its working fine.
The First picklist value is came from ILI__c, Second picklist values came from Inventory_Pallet__c. refer the Apex class
But my requirement is how to display the two picklist values in one pageblock.
Thanks
Sundar
You should be able to compress these into a single pageblocksectionitem by surrounding them both with an outputPanel.
Something like:
Hi Bob
Thanks for your suggestion. Later i found this solution.,
Thanks
Sundar
Hi bob
Thanks for your support. I have been removed that property..The picklist values will shown properly. but when i add the second product the first product pallet pick list values has overridden with second product pallet pick list. this is my problem
Thanks
sundar
Bob
Yes you are right pallet pick list values are contained in single variable. but the pallet information should be displayed based on the Selected ILI picklist values. i have no issues when i add the single product.
After added the sencond product and select the ILI and Pallet list its working. if i click the AddlineItems button the second Product pallets has over ridden with first product pallet pick list.. Still i am lacking in this problem..
click the Addlineitems button this InvPalletMainList Method will called..
public List<Inventory_Pallet__c> invPalletMList {public get;public set;}
public void InvPalletMainList() {
for(ILIPalletinnerclass il : InventoryPalletli ) {
if ( il.isSelected == TRUE ) {
PalletIds.add(il.Palletselectoption );
}
}
if( PalletIds.size() > 0 ) {
for(Inventory_Pallet__c i:[SELECT Id,Name,Product__c,Inventory_Line_Item__r.name,Gross_Weight__c,Tare_Weight__c,Net_Weight__c
FROM Inventory_Pallet__c
WHERE id=: PalletIds and Status__c='Inward']) {
if ( palletIdSet.contains(i.Id) == false ) {
palletIdSet.add(i.Id);
invPalletMList.add(i);
}
}
}
// return invPalletMList;
}
Thanks
Sundar
This is because you have a single variable backing the selected product - inwardLI. Whenever you choose the selectlist value for any product, the selected item will be stored in this variable. This means that all product selectlists will choose the same product (as they all use the same variable). As you have a single method to generate the pallet selectlist based on the inwardLI variable, every instance of the pallet selectlist then has the same options.
Each selectlist value needs to be a different variable, and you'll need to store the selectlist options in the class that you use to back the pageblocktable.
Yes bob
I was tried to implement the dependent picklists in the same pageblock. but i can't implement due to the single variable problem. as per your suggestion i was used my old design. its working fine.
Thanks for your support
Thanks
sundar