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
Ramana123Ramana123 

The page is continuosly refreshing ,when i use rerender the pageblock table is not coming .can anyone help me in this ..?

How  to stop the page from refreshing continuously...?

apex page :

<apex:page controller="searchClass">
    <script>
    
    window.onload = function()
    {
        some();
        }
    
    </script>
    
    <apex:form >
        <apex:pageBlock>
            <apex:pageBlockSection >
               <apex:actionfunction action="{!searchContact}" name="some">            

            <apex:pageBlockTable value="{!Listcontacts}" var="con" id="abc">
                <apex:column value="{!con.Name}"/>
                
            </apex:pageBlockTable>
              </apex:actionfunction>

            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

apex class :

 public class searchClass
{
   
    public List<Contact> result{get;set;}
    public List<Contact> Listcontacts {get;set;}
    public searchClass()
    {
        
           Listcontacts = new List<Contact>();
    }
               

    public void searchContact()
    {
      
        Listcontacts = [ SELECT Name from Contact];
            System.debug('aaaaaaaaaaaaaaaaaaaaa'+Listcontacts);

    }
    
     }





 
TechingCrewMattTechingCrewMatt
Would you please tru adding the rerender attribute to the actionfunction tag as seen below?
 
<apex:actionfunction action="{!searchContact}" name="some" rerender="abc">
Thar will prevent the page from reloading when the some() function completes.

Thanks,
Matt
Ramana123Ramana123
hiiii Matt, yes,when i use rerender i am not getting the contacts list its showing empty in pageblock table
TechingCrewMattTechingCrewMatt
When you run the query from Query Editor in Developer Console what are the results?
SELECT Name from Contact

 
TechingCrewMattTechingCrewMatt
The following works for me when I added a Contact record:
<apex:page controller="searchClass">
    <script>
    
    window.onload = function()
    {
        some();
        }
    
    </script>
    
    <apex:form >
        <apex:actionfunction action="{!searchContact}" name="some" rerender="abc"/> 
        <apex:pageBlock>
            <apex:pageBlockSection >
           
				<apex:pageBlockTable value="{!Listcontacts}" var="con" id="abc">
                <apex:column value="{!con.Name}"/>
                
            </apex:pageBlockTable>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

The table should not be inside the actionfunction element. The actionfunction tag should be inside the form, but not the pageBlock.
Matt