Wednesday, 7 December 2011

InlineEditing on Visual Force Page

Controller:


public class testpagecontroller{
public List<account> acclst=new List<account>();
      public List<account> getaccounts(){
      acclst=[select name,industry,type from account];
      return acclst;
}
public void save1(){

       update acclst;

}

}
====VisualForcePage

<apex:page controller="testpagecontroller">
<apex:form >
<apex:pageBlock mode="inlineEdit">
<apex:pageBlockButtons >
<apex:commandbutton value="save" action="{!save1}"/>
</apex:pageBlockButtons>
<apex:pageBlockTable value="{!accounts}" var="a">
<apex:column Headervalue="Account Name">
<apex:outputfield value="{!a.name}"/>
</apex:column>
<apex:column headervalue="Industry">
<apex:outputfield value="{!a.industry}"/>
</apex:column>
<apex:column >
<apex:outputfield value="{!a.type}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

No comments:

Post a Comment

Get the Developer Name for Record Types without SOQL query

Hi, Previously, the developer name was accessible only via SOQL on the RecordType SObject, and not via describe information. Now you can ...