apex class : public class searchClass { public List result{get;set;} public List Listcontacts {get;set;} public searchClass() { Listcontacts = new List(); } public void searchContact() { Listcontacts = [ SELECT Name from Contact]; System.debug('aaaaaaaaaaaaaaaaaaaaa'+Listcontacts); } }", "answerCount": 4, "upvoteCount": 0, "datePublished": "2020-04-13T14:25:14.000Z", "author": { "@type": "Person", "name": "Yeturu Srikanth", "url": "https://trailblazers.salesforce.com/profileView?u=0053A00000E7UCRQA3", "affiliation": { "@type": "Organization", "name": "bigworks" } }, "suggestedAnswer": [ { "@type": "Answer", "text": "The following works for me when I added a Contact record: \t\t\t\t The table should not be inside the actionfunction element. The actionfunction tag should be inside the form, but not the pageBlock. Matt", "upvoteCount": 0, "url": "https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007T4IooSAF", "datePublished": "2020-04-13T15:41:56.000Z", "author": { "@type": "Person", "name": "Matt Kowalski", "url": "https://trailblazers.salesforce.com/profileView?u=0053000000BiC0TAAV", "affiliation": { "@type": "Organization", "name": "TechingCrew LLC" } } } ] } } Skip to main content
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);

    }

    

     }

 
4 Antworten
  1. 13. Apr. 2020, 15:41

    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
0/9000