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:
Thank's for reading....
5 comments:
really helpful thank you
Did this code work? How can you implement inline editing without using tag between tags ?
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
How would I use this for a custom Opportunity related object?
Please tell me how to save records in PageBlock using Inline edit for Custom Objects
Post a Comment