VisualForce, Apex: repeat, for Javascript Update array

This is an extension of the question I asked on the boards of Salesforce developers who didn't play much:

I have a VisualForce page that requires frequent changes to load new information from the controller and embed this information in a Javascript array for future use.

Rejected solution: rI was successful using VisualForce browser technologies, as described here (on the Wiki): http://wiki.developerforce.com/index.php/Using_Browser_Technologies_in_Visualforce_-_Part_1

I surround Javascript array.push with recommended tags:

<apex:repeat value="{!Object}" var="objects">       
    d.push( {
               element1: "{!objects.id}"            
    })
</apex:repeat>

Problem. The array is correctly filled when the entire page is updated, and when I use my drop-down list to change the filter on the object (in the controller), the DOM is updated (I can see that new information is being placed on the page),

Ultimately, however, the Javascript array does not change its value if I did not cause an update on the entire page, which leads to the victory over Partial Refresh and is a shock for the system for users.

This problem with the required record was not a problem before, and even when I directly call the Javascript function, which contains this collection of arrays after updating the DOM, the Javascript array does not change (so I assume that it loads once depending on what is in the DOM when the page is initially sent back and cannot be changed.

Thoughts?

+3
1

, , rerender, . jQuery, .

<apex:commandButton action="{!something}" rerender="scriptPanel"/>
<apex:outputPanel id="scriptPanel>
  <script>
     d = new Array();
     <apex:repeat value="{!objects}" var="object">
       d.push({
           element1: "{!objects.id}"            
       });
     </apex:repeat>
  </script>
</apex:outputPanel>
+5

Source: https://habr.com/ru/post/1796176/


All Articles