You need to sign in to do that
Don't have an account?
Deepikareddy
Visualforce page:
after debugging iam getting the selectedvalue,as null.., can anybody help to solve the issue. thank you...
Datatable and Repeatfunctionality in salesforce
public class testclass5 { public list<wrapperclass> wrapclass{get;set;} public testclass5(){ wrapclass = new list<wrapperclass>(); string teststring= ' { "sucess":1,"data": [ {"stateName": "Andrapradesh", "value": "apx" }, { "stateName": "Telangana", "value":"tsx"}, {"stateName": "Banglore", "value": "bngx"} , {"stateName": "Maharastra", "value":"mhx" } ] } '; Map<String, Object> maptest = (Map<String, Object>) JSON.deserializeUntyped(teststring); system.debug(maptest); Object ob = (Object)maptest.get('data'); System.debug(ob); String srlze = System.JSON.serialize(ob); system.debug(srlze); wrapclass = (list<wrapperclass>)System.JSON.deserialize(srlze,list<wrapperclass>.class); system.debug(wrapclass); } public string selectedValue{get;set;} public pageReference testmethod1(){ system.debug('for Datatable functionality:'+ selectedValue); return null; } public pageReference testmethod2(){ system.debug('for repeat functionality:'+ selectedValue); return null; } public class wrapperclass{ public string stateName{get;set;} public string value{get;set;} } }
Visualforce page:
<apex:page controller="testclass5"> <apex:form > <apex:dataTable value="{!wrapclass}" var="a" cellpadding="6px"> <apex:column > <apex:actionsupport action="{!testmethod1}" event="onclick"> {!a.stateName}<apex:param name="selectedValue" value="{!a.value}" assignTo="{!selectedValue}"> </apex:param> </apex:actionsupport> </apex:column> </apex:dataTable> <br/> <apex:actionsupport action="{!testmethod2}" event="onclick"> <apex:repeat value="{!wrapclass}" var="a" > <li style="padding:5px;"> {!a.stateName}<apex:param name="selectedValue" value="{!a.value}" assignTo="{!selectedValue}"> </apex:param> </li> </apex:repeat> </apex:actionsupport> </apex:form> </apex:page>
after debugging iam getting the selectedvalue,as null.., can anybody help to solve the issue. thank you...
use this code may be this will help you to getting value.
Regards,
Soyab
All Answers
use this code may be this will help you to getting value.
Regards,
Soyab