You need to sign in to do that
Don't have an account?

Hide buttons only used for Inline Editing
Hello,
InlineEditing allows us to show and hide buttons during and after editing inline. However buttons I want hidden by default are displayed.
For instance, I have several buttons I want to show by default and hide when editing, plus a Save and Cancel button that I want hidden unless told to display by inline editing. But when the page loads all of these buttons are displayed. How am I supposed to make Save and Cancel hidden on page load, surely I dont have to use JS or CSS for that, it must be part of the inline editing capability surely?!
MORE INFO: Im not using a standard controller everything in the page is handled in a class. Clicking the Save button (which calls a save method which updates the database, as you'd expect) doesnt save any changes made in inline editing.
I'm starting to think that inline editing will only work with a Standard Controller...
Hi,
Try adding style="display: none;" to the apex:commandButton components that you wish to hide when the page is loaded. For example:
That worked for me when using a standard controller.
All Answers
Have you tried using a conditional 'Rendered' attribute in the commandButton?
you may also find this article helpful: http://www.forcetree.com/2009/11/inline-editing-in-visualforce.html
I'm using Inline Editing as enabled by the Spring 11 update, not any customized way of doing it.
Tryout this sample code given below to hide the buttons after inline editing :
<script>
function HideShow(rId,Id,mode)
{
var rowId = rId;
var accountId = Id;
var editrowId = 'edit:'+ Id;
if(mode == 'n')
{
document.getElementById(rowId).style.display = 'none';
document.getElementById(editrowId).style.display = 'block';
document.getElementById(pqr).style.display = 'none';
}
else if(mode == 'e')
{
var rrowId = 'detail:'+ Id;
document.getElementById(rrowId).style.display = 'block';
document.getElementById(rowId).style.display = 'none';
}
}
</script>
<input id="pqr" type="button" class="btn" value="save" onclick="HideShow('edit:{!a.id}','{!a.id}','e');savedata('{!a.id}');"/>
I am facing the same problem where I need to show "Save" and "Cancel" button in inlineEdit Mode and then hide it when its not in that mode. Here is sample code:
apex:page standardController="QuoteChargeItem__c" extensions="xxxDetailController"> apex:form >
apex:pageBlock title="{!$ObjectType.QuoteChargeItem__c.label}" mode="inlineEdit"> apex:pageBlockButtons >
apex:commandButton action="{!edit}" id="editButton" value="Edit"
apex:commandButton action="{!delete}" id="db" value="Delete"
apex:commandButton action="{!URLFOR($Action.QuoteChargeItem__c.Clone,QuoteChargeItem__c.id)}" id="cb" value="Clone" apex:commandButton action="{!save}" id="saveButton" value="Save"
apex:commandButton onclick="resetInlineEdit()" id="cancelButton" value="Cancel"
/apex:pageBlockButtons>
apex:pageBlockSection showHeader="true" title="Information" columns="2">
apex:outputField value="{!QuoteChargeItem__c.Fin_Code__c}">
apex:inlineEditSupport showOnEdit="saveButton, cancelButton" hideOnEdit="editButton, db, cb" event="ondblclick" changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"
/apex:outputField>
apex:outputField value="{!QuoteChargeItem__c.Rate_Base__c}"
apex:pageBlockSectionItem
apex:outputField value="{!QuoteChargeItem__c.Name}" rendered="false"
apex:pageBlockSectionItem
/apex:pageBlockSection>
/apex:pageBlock>
apex:page>
/apex:form>
I get the feeling this feature has been rushed out, I shouldnt have to write css or script to hide buttons, it should handle it.
Does the Save button work on your page? I imagine it will because you have a standard controller. Doesnt save anything on mine because I'm using a class instead - another oversight. If it only works with a standard controller the documentation should say so!
Hi,
Try adding style="display: none;" to the apex:commandButton components that you wish to hide when the page is loaded. For example:
That worked for me when using a standard controller.
I know your issue has been resolved but still I would like to share some good experience with inline editing:\
You can use the following the show and hide the buttons whatever you want:
This works for me:
<apex:commandButton action="{!save}" value="Save" id="saveButton" style="display: none;"/>
Thanks a lot for the post.
Weiping
Hi Bhawani,
My problem with this is bit different there is one inline VF page where i am showing a list in Page Block tabel having inline edit enabled when ever i double click on those filed its inline editing working showing the Save and Cancel button as it was expected but if that list is updated inline editing showonclick event doest works.
Can you please suggest something?
Requirement:-
I have displayed the rows in a table and using inlineEditSupport tag in the output field tag of salesforce. I will check the checkbox corresponding to each row whenevr I edit any values in the row.
I am stuck in how to uncheck the checkbox when I click on undo button?
For this I am using resetFunction and I am passsing this into it but it is giving [object window] in the logs which I think is a global window object.
How I could find which row is edited by inlineEditSupport tag so that I can uncheck the checkbox on undo button.?
Please help. Thanks in advance.
-Abhishek
Thanks KevinLaurence and Bhawani.