Saturday, August 2, 2014

Inline Editing in Visualforce Page.

Inline Editing in Visualforce Page.


Hi,
In this post i am giving basic example of how to work with inline editing in visualforce page.

Controller Class:
public class AccountInlineEditCLs {
public List<account> acclst=new List<account>();

public List<account> getAccounts(){
 acclst=[select name,industry,type,Description from account];
      return acclst;

}

public void save1() {
     update acclst;
}
}

Visualforce Page:

<apex:page controller="AccountInlineEditCLs">
<apex:form >
<apex:pageBlock mode="inlineEdit">
<apex:pageBlockButtons >
<apex:commandbutton value="save" action="{!save1}"/>
</apex:pageBlockButtons>
<!-- calling getAccounts() methods in pageblock table -->
<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>

Output: 

save image


save image



Thank's for reading....




5 comments:

TJ said...

really helpful thank you

nothing said...

Did this code work? How can you implement inline editing without using tag between tags ?

Anonymous said...

Hi
This Post help me a lot. i have a doubt, how can we check user has updated any value in table before pressing Save button

Unknown said...

How would I use this for a custom Opportunity related object?

Unknown said...

Please tell me how to save records in PageBlock using Inline edit for Custom Objects

Post a Comment

 
| ,