You need to sign in to do that
Don't have an account?
SeattleSFDC
Visualforce page from json response with radio button selection
I used json2Apex to create the wrapper class, and I was able to get it displayed on my Visualforce page. But now i want to add a radio button selection next to each row. So that i user can select one record and have the passed back to a Salesforce custom object. There's no Salesforce object in this wrapper class because it's based on the json reponse. Is there a way to wrap my data in Visualforce if the response I'm using is not tied to a Salesforce object? Documentation I'm finding online are for wrapper classes for Accounts, Contacts, etc.
VF:
<apex:pageblockTable value="{!jsonRecords}" var="accWrap" rendered="{!jsonRecords.size != NULL}">
<apex:column width="50px">
<input type="radio" name="group1" value="{!accWrap.selected}"/>
</apex:column>
<apex:column value="{!accWrap.PARTY_NAME}" headerValue="Account Name"/>
</apex:pageBlockTable>
Wrapper Class:
public class JsonWrapper {
public class P_CUSTOMER_TBL_ITEM {
public Boolean selected{get;set;}
public String PARTY_NAME{get;set;}
public P_CUSTOMER_TBL_ITEM(string PARTY_NAME) {
this.selected = false;
this.PARTY_NAME = PARTY_NAME;
}
}
}
VF:
<apex:pageblockTable value="{!jsonRecords}" var="accWrap" rendered="{!jsonRecords.size != NULL}">
<apex:column width="50px">
<input type="radio" name="group1" value="{!accWrap.selected}"/>
</apex:column>
<apex:column value="{!accWrap.PARTY_NAME}" headerValue="Account Name"/>
</apex:pageBlockTable>
Wrapper Class:
public class JsonWrapper {
public class P_CUSTOMER_TBL_ITEM {
public Boolean selected{get;set;}
public String PARTY_NAME{get;set;}
public P_CUSTOMER_TBL_ITEM(string PARTY_NAME) {
this.selected = false;
this.PARTY_NAME = PARTY_NAME;
}
}
}