You need to sign in to do that
Don't have an account?
How to use inlineEditSupport in VF page to edit a pick list which I am getting using DTO?
I am learing REST.... During developing code for calling PUT method I stuck at a point. I am loading a pick list at the load time depending on account name selected I am listing below the table for Status of cases available for that Account. Now I want to edit that Status and save it. But I am not able to use inlineEditSupport component as I am using DTO....anyonw know how to solve this issue??
I needed to create DTO as my REST methods do not let me to store response as a case list.
my code is here:
(I am commenting some part)
VF page :
APEX / Controller /class code :
I needed to create DTO as my REST methods do not let me to store response as a case list.
my code is here:
(I am commenting some part)
VF page :
<apex:page standardController="Account" Extensions="demoExtension"> <apex:form > <apex:pageBlock > <apex:pageBlockSection title="Picklists" columns="2"> <apex:selectList value="{!selectedAccounts}" size="1" label="Account" > <!-- <apex:actionSupport event="onchange" action="{!getOpenCases}" status="assign-action-status" reRender="theForm, caseResults"/> --> <apex:selectOptions value="{!items}"/> </apex:selectList> </apex:pageBlockSection> </apex:pageBlock> <apex:pageBlock mode="inlineEdit"> <apex:pageBlockTable value="{!resDtolist}" var="val" > <apex:column value="{!val.Status}" headerValue="Status"/> <apex:inlineEditSupport event="ondblClick" /> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>
APEX / Controller /class code :
public class demoExtension { // stores selected account option public String selectedAccounts { get; set; } public List<RestDTO> resDtolist{ get; set; } // stores accounts (used as drop down list) public List<Account> accountList { get; set; } // constructor public demoExtension(ApexPages.StandardController controller) { accountList = [SELECT name, id, OwnerId FROM Account WHERE OwnerId=:UserInfo.getUserId()]; resDtolist = new List<RestDTO>(); for(Case c : [SELECT ID, Subject , Status , Owner.Id , Owner.Name FROM case LIMIT 10]){ resDtolist.add(new RestDTO(c)); } } // creates drop down list of options (account ids and names) public List<SelectOption> getItems() { List<SelectOption> options = new List<SelectOption>(); for(Account actName : accountList ) //constructor { options.add(new SelectOption(actName.name, actName.name)); } return options; } public class RestDTO{ public String Id{ get; set; } public String Subject{ get; set; } public String Status{ get; set; } public String OwnerId{ get; set; } public String OwnerName{ get; set; } public RestDTO(Case c){ this.Id = c.Id; this.Subject = c.Subject; this.Status = c.Status; this.OwnerId = c.OwnerId; this.OwnerName = c.Owner.Name; } } }
I am changing a little bit code of yours.
look it work fine!
Visualforce Page --
Extension --
All Answers
I am changing a little bit code of yours.
look it work fine!
Visualforce Page --
Extension --