I am making a Ajax call to a REST API and parsing the response and maintaining the parsed values in a delimited string. I want to display the same string in the pageblocktable without taking the control to the controller. I want everything to be in Javascript.
VFPage:
JS:
function()
{
$.ajax(
{
url : weblink,
success : function(result)
{
var resultData = result.content.resultData[i]
//assume resultData is a delimited string
document.getElementById('pgad1:frm:ADValues').value = resultData ;
}
}
}
PageBlockTable:
<apex:inputHidden value="{!ADAddrList}" id="ADValues"/>
<td width="50%" valign="top">
<apex:pageBlock mode="maindetail" id="addresspb">
<apex:pageBlockTable value="{!AddrLst}" var="r" id="records" rendered="{!NOT(ISNULL(AddrLst))}">
<apex:column >
<input type="radio" name="SelectAddress" value="{!r.fulladdress}" onclick="changeValue(this, '{!$Component.RadioButtonValue}');" />
</apex:column>
<apex:column headerValue="City" Value="{!r.locality}" />
<apex:column headerValue="State/Province" Value="{!r.province}" />
<apex:column headerValue="Zip Code/Postal Code" Value="{!r.postcd}" />
</apex:pageBlockTable>
</apex:pageBlock>
<apex:actionFunction name="SelectedAddress" action="{!SelectedAddress}" rerender="Address" status="myStatus"/>
<apex:inputHidden value="{!AddrSelectedValue}" id="RadioButtonValue" />
<apex:actionFunction name="Validate" action="{!Validate}" rerender="Address,addresspb" status="myStatus"/>
</td>
At present I am passing the string to controller using actionfunction and then displaying it on the page. But, I want to know how can we display the string in the pageblocktable without calling the controller.
Please help!
Thanks, Prashant