function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
rupesh ranjanrupesh ranjan 

display data in page block table Based on picklist selection

how to display corresponding data in page block table of VF page Based on picklist selection.

some sample code please
Best Answer chosen by rupesh ranjan
Ruwantha  LankathilakaRuwantha Lankathilaka
You need to put your pageblocktable in side a outputpanel and when you retreive the data to the table make sure you filter the data based on the picklist selection value. Then use apex:actionSupport to rerender the output panel at the onchage event of the actionSupport.

All Answers

Ruwantha  LankathilakaRuwantha Lankathilaka
You need to put your pageblocktable in side a outputpanel and when you retreive the data to the table make sure you filter the data based on the picklist selection value. Then use apex:actionSupport to rerender the output panel at the onchage event of the actionSupport.
This was selected as the best answer
rupesh ranjanrupesh ranjan
Yes but how to filter the data based on picklist selection
rupesh ranjanrupesh ranjan
because my data is coming from other service. and we displaying in table then how to filter
Krishna SambarajuKrishna Sambaraju
Here is an example of filtering data based on different search criteria. Hope this is helpful.

http://blog.jeffdouglas.com/2010/07/13/building-a-dynamic-search-page-in-visualforce/
Ruwantha  LankathilakaRuwantha Lankathilaka
Okay, Let's think you need to fiter the tax type based on the country you select. then we do someting like this.
In the controller do something like this
 
public String selectedCountry{get;set;}
 
public list<TaxObject> getTaxes(){

// implement the logic that returns the list of selectOptions based on country

if(selectedCountry != null){
  return  this.countryTax(selectedCountry);
}else{
// give error message
}
return null;
} 

public list<SelectOption> getCountries{
// return the country option list
}
In your page do somting like this
<apex:selectList id="fld1" value="{!selectedCountry}" multiselect="false" size="1" >                                            

    <apex:selectOptions value="{!Countries}"/>       
    <apex:actionSupport event="onselect" action="{!Taxes} rerender="taxPanel
                          " status="SearchStatus immediate="true"/>                                                      
 </apex:selectList>


 
<apex:outputpanel id="taxPanel">
	<apex:dataTable value="{!taxes}" var="tax" id="theTable" rowClasses="odd,even"

                        styleClass="tableClass">

		<apex:facet name="caption">table caption</apex:facet>

		<apex:facet name="header">table header</apex:facet>

		<apex:facet name="footer">table footer</apex:facet>

		<apex:column>
		        <apex:facet name="header">Tax Name</apex:facet>
     			<apex:outputText value="{!tax.name}"/>
		</apex:column>
		<apex:column>

			<apex:facet name="header">Rate</apex:facet>
			<apex:outputText value="{!tax.rate}"/>

		</apex:column>

	</apex:dataTable>
</apex:outputpanel>

To do this you'll need a wrapper class called "TaxObject". Hope you got the idea.