function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Regina200Regina200 

Creating editable data table in Visualforce (like excel cells)

Hi everyone,

I am not too familiar with coding or anything like this, so I'm having some trouble figuring out how to create an editable data table. We currently use excel spreadsheets for our contract fees, but we want to transition this process into Salesforce.

I think the best way to do this would be to create a Visualforce Page that I can then add to my Page Layout. The table I want to create is a revenue timeline, with the rows being the different type of fees and the columns being each time period (monthly). While the labels in the row are standard, the labels for each column differs depending on when the contract began. It would also be nice to add a final column being the total which is a formula of each row. But for now, I am trying to just create the main body of the data table. Any help would be greatly appreciated!! Thank you so much.
Ashish DevAshish Dev
There exist some apps on appexchange, you may want to give them a try.
@ https://appexchange.salesforce.com/results?keywords=inline%20edit
Regina200Regina200
Ashish Dev-Thanks for the response, but I am quite limited in that aspect, because I don't want to purchase a separate app and I only have professional edition...I thought creating a data table would be my best bet (but I am slowly starting to realize that isn't the easiest)
Ashish DevAshish Dev
You can create a list view under concerned object's tab, it would have inline edit if you do not have multiple record type for that object or 
you have to ensure that your view criteria limit the list view to a single record type.
 
Regina200Regina200
Ashish-I don't think I've explained the issue properly. So I am trying to create a section in my "Contract" Objects that has a data table. It would be like a field and the user would have to input the data in for each separate contract. I wanted to customize a VisualForce Page (the data table) that I can add to the page layout.
Ashish DevAshish Dev
In that case I would recommend you to use enhancedList instead of datatable. More @https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_enhancedList.htm.

Again inline edit out of the box supported in case of single record type.

in VF do something like that.
<apex:page>
    <apex:enhancedList type="Account" height="300" rowsPerPage="10" id="AccountList" />
</apex:page>

 
William TranWilliam Tran
You can use the code below as a template to do that.  Just cut and paste and run. There's no custom fields so it should just work.

As a common practice, if your question is answered, please choose 1 best answer.
But you can give every answer a thumb up if that answer is helpful to you.

Thanks

 
<apex:page standardController="Opportunity" recordSetVar="opportunities">
    <apex:form >
        <apex:pageBlock >
            <apex:pageMessages />
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}"/>
                 <apex:commandButton value="Quick Save" action="{!quicksave}"/>
            </apex:pageBlockButtons>
            <apex:pageBlockTable value="{!opportunities}" var="opp">
 
                <apex:column value="{!opp.id}"/>
                <apex:column value="{!opp.name}"/>
                
                <apex:column headerValue="Stage">
                    <apex:inputField value="{!opp.stageName}"/>
                </apex:column>

                <apex:column headerValue="Amount">
                    <apex:inputField value="{!opp.amount}"/>
                </apex:column>
            </apex:pageBlockTable>     
            <apex:panelGrid columns="2">
                  <apex:commandLink action="{!first}">First</apex:commandlink>
      <apex:commandLink action="{!last}">Last</apex:commandlink>
      <apex:commandLink action="{!previous}">Previous</apex:commandlink>
      <apex:commandLink action="{!next}">Next</apex:commandlink>
    </apex:panelGrid> 
        </apex:pageBlock>
    </apex:form>
</apex:page>

 
Regina200Regina200
Ashish & William--Thank you both very much for your input! I've been playing around with both the codes you guys provided. But I think it'll take me a while to customize it to what I need, so perhaps I can ask you, as you guys clearly know what you're doing! Is there a way to have a standard column without inputing a field value? For example, the "Fee 1, Fee 2, Fee 3" are all standard names.  I am trying to recreate the table below...

                  Jan-15        Feb-15         Mar-15       Apr-15 .......
Fee 1
Fee 2
Fee 3 

 
William TranWilliam Tran
It will be tough to answer your questions without much more details.  Feel free to email me and we can discuss your needs and how to get you your solution.

Thx
Maeze AhlersMaeze Ahlers
William, 

I'd like to use the code you provided to make sort-of a dashboard will a grid of 9 of these tables, all separated into different lists of prospects. Is there a way I can filter each VF page according to a certian list I've already created? It will be related to the opportunity object. 

Thanks in advance!!
Jyothi HJyothi H
Hi Regina, 

I just want to know were u able to solve the question which u have asked? and if u were able to, Please tell me how did u solve that?
Because I m struck in similar thing.. Thanks in advance.