+ Start a Discussion
jojoforcejojoforce 

LIST<Account> to a JavaScript Array?

Is there a way to pass a LIST into a javascript array and be able to access the fields from the javascript array?

 

So the controller would have something like...

public LIST<Account> acct {get; set;}
acct = [SELECT Id, Name, Field1 FROM Account];

 

 

 

Then the visual force page will have something like..

<script> var result = [] </script>

<apex:repeat value="{!acct}" var="acctitem">
<script>
result[idx2++] = "{!acctitem}";
</script>    
</apex:repeat>

 

 

So that when the JavaScript array is initialized, I can do something like

 

 

result[0].Id

result[0].Name



result[1].Id

result[1].Name

kprkpr

Hi,

 

Did you find a solution to this? I'm facing the same issue.

 

Thanks,

kpr