You need to sign in to do that
Don't have an account?
Deepikareddy
hi , im getting the data in the visualforce page , but the data is getting iterable when i use the repeat functionality inside the table , can anybody have the solution for this ??it should not iterate again .. thanks in advance
Deserialing the array data in the apex repeat tag
public class test5 { public list<string> lststatename{get;set;} public list<string> lstrating{get;set;} public test5(){ string jsonexample1 = ' { "overalldata": [ {"stateName": "Andrapradesh", "rating": 5.0 }, { "stateName": "Telangana", "rating": 4.0 }, {"stateName": "Banglore", "rating": 5.0 } , {"stateName": "Maharastra", "rating": 4.5 } ] } '; map<string,object> metadatamap= (map<string,object>)json.deserializeuntyped(jsonexample1); list<object> values1= (list<object>)metadatamap.get('overalldata'); lststatename= new list<string>(); lstrating= new list<string>(); for(object parsed : values1){ map<string,object> values = (map<string,object>)parsed; string statename = string.valueof(values.get('stateName')); string rating= string.valueof(values.get('rating')); lststatename.add(statename ); lstrating.add(rating); } } }visualforce page:
<apex:page controller="test5" > <apex:form > <table> <tr> <th>states</th> <th>rating</th> </tr> <apex:repeat value="{!lststatename}" var="a"> <apex:repeat value="{!lstrating}" var="b"> <tr> <td>{!a}</td> <td>{!b}</td> </tr> </apex:repeat> </apex:repeat> </table> </apex:form> </apex:page>
hi , im getting the data in the visualforce page , but the data is getting iterable when i use the repeat functionality inside the table , can anybody have the solution for this ??it should not iterate again .. thanks in advance
One more update needs to be done. Please refer the below final updated code:
Also, find the attached image of the class in my org.
Hope this will solve your problem. If does then mark it as the best answer so it can also help others in the future.
Many Thanks,
Sunil Rathore
All Answers
Greetings to you!
Please refer the below code:
Hope this will help you. If does then mark it as the best answer so it can also help others in the future.
Many Thanks,
Sunil Rathore
thanks
Please refer the below code using HTML table:
Hope this will help you. If does then mark it as the best answer so it can also help others in the future.
Many Thanks,
Sunil Rathore
Hi sunil, iam getting the below error, may i know the reason behind it..
Remove the wrapper class from the constructor. Refer the below code
Hope this will help you. If does then mark it as the best answer so it can also help others in the future.
Many Thanks,
Sunil Rathore
hi sunil sorry , removed ,the copied the same code in the apex class of name test6 ,but it is not getting save , it was showing the below error ,any prerequisite is there , to done before saving the class? thank u
No there is no prerequisite to save this class. Make sure you also use the same class name for the controller of VF page.
Please use the below code:
thanks in advance
One more update needs to be done. Please refer the below final updated code:
Also, find the attached image of the class in my org.
Hope this will solve your problem. If does then mark it as the best answer so it can also help others in the future.
Many Thanks,
Sunil Rathore