+ Start a Discussion
anup ramanup ram 

Edit on pageblocktable in specfic rows

Hi I have a urgent requirement to edit specific rows on pageblocktable.

I am able to delete the specific row but not getting how to edit specific row.

 

can somebody share me a working code snippet so that i can refer and implement the logic.

 

Please help me

 

 

DaveHDaveH

So basically what you'll need is a custom "paging" object which contains the object to be edited and a boolean flag to specify whether that row is in edit mode or not.

 

For example:

 

class PageController {
    /* All your controller methods and vars here */
    List<PagingObject> objects {get; set;}

    public class PagingObject {
        // This keeps track of whether this item is in edit mode or not
        // If it is then you should render input fields
        public Boolean inEditMode {get; set;}
        public CustomObject__c objectRef {get; set;}

        public PagingObject(CustomObject__c obj) {
            this.inEditMode = false;
            this.objectRef = obj;
        }      
    }
}

 

So you can see the inner paging object above. Now in your tables you should iterate over the paging objects instead of the standard SF objects. That way you can check and change each object individually to take it in and out of edit mode.

 

When the object is in edit mode you should display input fields, when it isn't in edit mode you should just display output fields.

asish1989asish1989

Hi

You can use wrapper class for this functionality.I am sharing link of how to use wrapper class

http://wiki.developerforce.com/page/Wrapper_Class

 

Also some extra code you will need ,  I am adding that one...

<apex:column headerValue="Action">
<apex:commandButton value="Edit" title="to edit contact" id="editButton" action="/apex/PcontactDetail?Id={!c.con.id}" style="color:blue">
</apex:commandButton>

PcontactDetail is my page, You will create a vf page containing some field and a command button(save);

Refer to that page for edit.

You can write

<apex:commandButton value="Edit" title="to edit contact" id="editButton" action="/apex/YourVFpage?Id={!c.con.id}"/>

 

If this post answers your questions please mark it as solved and give kudos for this post

 

Thanks

anup ramanup ram

 Thanks for the share @DevH.

 

But it is working for multiselect edit.  How do i do it for a specific row.

 

In a row i have edit commandlink on click of that quantity field should become input for that row.

 

I am still struck in the implementation.

 

 

can u please share code showing the complete implementation.