You need to sign in to do that
Don't have an account?
Add data in apex:pageBlockTable using jquery and get its data and send back to apex class
public class formBuilderClass { public Map<String,List<String>> objectFieldMap { get { if(objectFieldMap == null) { objectFieldMap = new Map<String,List<String>>(); } return objectFieldMap; } set; } public void viewMap() { System.debug('wew objectFieldmap' + objectFieldMap); } }And then I've created a visual force page that includes pageBlockTable and a script to insert data to the table which is something like this.
<apex:pageBlock > <apex:pageBlockTable value="{!objectFieldMap}" var="field" styleClass="table table-striped" id="tableField"> <apex:column width="30%" value="{!objectFieldMap[field][0]}" headerValue="SALESFORCE FIELD" styleClass="wew" /> <apex:column width="30%" value="{!objectFieldMap[field][1]}" headerValue="CSV FIELD" styleClass="wew" /> </apex:pageBlockTable> </apex:pageBlock> <apex:commandButton value="Submit" action="{!viewMap}" styleClass="btn btn-block btn-strong-green"/> <script> $(document).ready(function(){ $('[id$="tableField"]').append('<tr><td>sample data 1</td><td>sample data 2</td></tr>') ; }); </script>What I want to accomplished, is that I want to get all the data appended to the table using javascript. So that, when I clicked the submit button I can see the new value for my objectFieldMap variable. Is it possible ? or are there any easier way to do a scenario which is something like this ? please help. Thank you...
When you're doing this client-side, you'll need to serialize that table into an array and then pass that back via a RemoteAction to set that controller variable.