You need to sign in to do that
Don't have an account?
Manjeet
PageBlockTable & DataTable issues with Ajax
Can We rerender the the above mentioned component through ajax ?
I found a No in visualforce tutorials . I need to refresh the content of a pageblocktable .
is there any way to refresh pageblockcomponent .
thanks in advance.........
You are creating a new prospects list when the user clicks the search button, but your getProspectsList method always overwrites it based the results of this query:
I'd suggest you change your code to only run this query if prospectsList is null.
All Answers
Hi Manjeet,
Place your PageBlockTable inside an <apex:outputPanel> and rerender the outputPanel instead of the pageBlockTable.
The outputPanel will inturn rerender ur table.
PageBlockTable Data is not updated when i enter customer name or prospect ref no and click on search button .
plz let me know where i am doing mistake .........
visualforce Page
<apex:page controller="ProspectListController" sidebar="false" tabStyle="Lead">
<apex:pageblock title="Retail Client Management >> Prospects" id="theBlock" >
<apex:form id="theForm" >
<apex:pageblockSection columns="3" title="Search By" collapsible="false">
<apex:pageblockSectionItem >
Prospect Ref No <apex:inputText value="{!prospectRefNo}" />
</apex:pageblockSectionItem>
<apex:inputField value="{!Prospects.Customer_Name__c}" id="Custom123" />
<apex:inputField value="{!Prospects.Prospect_Source__c}" />
<apex:inputField value="{!Prospects.Type_Of_Relationship__c}" />
<apex:pageBlockSectionItem >
<apex:commandButton reRender="thePanel123,myId" action="{!search}" value="Search" />
</apex:pageBlockSectionItem>
</apex:pageblockSection>
<apex:commandButton action="{!newProspect}" value="New Prospect" /> <br/>
<apex:outputPanel id="thePanel123">
<apex:pageBlockTable value="{!prospectsList}" var="aa" id="mytable" >
<apex:outputField value="{!aa.Customer_Name__c}"/>
<apex:column headerValue="Prospect Ref No">
<apex:outputLink value="/apex/ProspectDetail?id={!aa.id}" >
{!aa.name}
</apex:outputLink>
</apex:column>
<apex:column value="{!aa.Customer_Name__c}" />
<apex:column value="{!aa.Type_Of_Relationship__c}" />
<apex:column value="{!aa.Prospect_Source__c}" />
<apex:column headerValue="E-Mail">
<apex:outputLink value="mailto:{!aa.E_mail__c}" >
{!aa.E_mail__c}
</apex:outputLink>
</apex:column>
</apex:pageBlockTable>
</apex:outputPanel>
<apex:panelGrid columns="2">
<apex:commandLink action="{!previous}" >Previous</apex:commandlink>
<apex:commandLink action="{!next}">Next</apex:commandlink>
</apex:panelGrid>
</apex:form>
</apex:pageblock>
</apex:page>
Controller class
public class ProspectListController {
List<Prospects__c> prospectsList;
Prospects__c prospects = new Prospects__c();
public String customerName { get; set; }
public String source {get; set;}
public String relationship { get; set ;}
public String prospectRefNo {get;set;}
public PageReference newProspect() {
return Page.NewProspect;
}
public PageReference search() {
customerName = Prospects.customer_name__c;
if(customerName != null)
prospectsList = [ select name,customer_name__c,type_of_relationship__c,prospect_source__c,e_mail__c from
prospects__c where customer_name__c like :customerName limit 1 ];
if(prospectRefNo != null)
prospectsList = [ select name,customer_name__c,type_of_relationship__c,prospect_source__c,e_mail__c from
prospects__c where name = :prospectRefNo limit 1 ];
Prospects = prospectsList .get(0);
return null;
}
public PageReference next() {
return null;
}
public PageReference previous() {
return null;
}
public List<Prospects__c> getProspectsList(){
prospectsList= [select name,customer_name__c,type_of_relationship__c,prospect_source__c,e_mail__c from
prospects__c ];
return prospectsList;
}
public Prospects__c getProspects(){
return prospects;
}
}
You are creating a new prospects list when the user clicks the search button, but your getProspectsList method always overwrites it based the results of this query:
I'd suggest you change your code to only run this query if prospectsList is null.
Hi Manjeet,
Remove the query from the getProspectsList() method.
public List<Prospects__c> getProspectsList(){
if(!prospectsList.isEmpty())
{
return prospectsList;
}
else
{
return null;
}
}
Prospect list is null when the class is first instantiated - the above code will throw a null exception when prospectsList.isEmpty() is executed.
Thanks a ton sir...
I also have a button "RESET" that reset all search fields .plzzz tell me how to reset the search fields when i click reset button .
does vf have any reset method like html ?