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
Vadivel MuruganVadivel Murugan 

Edit Option

Hi I am going to diaply the more than records with action like edit and remove.

When i have click the edit commandlink button that row only allow to able to modify. suppose i have to click the third row edit commandlink button that row only allow to able to modify. If any know reply me.

i have attached my sample screen shot.User-added image

 
Srinivas SSrinivas S
While iterating over the records, for the edit link please supply the corresponding record id.
Please post your code so that we can help.

Thanks,
Srinivas
Vadivel MuruganVadivel Murugan
Hi Srinivasa,

Kindly find the my vf page coding below:


<apex:page Controller="CustomAPIController" action="{!ListCategories2}">
   <!-- <apex:pageBlock >-->
   
   <script>

        function openPopup(url) {
            popupWindow=window.open(url, 'Popup','height=400,width=500,left=100,top=100,scrollbars=no,toolbar=no,status=no, resizable=no');
            return false;
         }

    </script>
         
        <apex:pagemessages id="msgs" />
        <apex:form id="frms">
        <apex:pageBlock >
        <apex:pageBlockButtons >
        <apex:commandbutton value="Save"  action="{!updatecat}" reRender="frms" rendered="{!SaveRender}"/>
        <apex:commandbutton value="Cancel"  action="{!cancel}" reRender="frms" rendered="{!SaveRender}"/>
        </apex:pageBlockButtons>
        <apex:variable value="{!0}" var="rowNumber" />
        <apex:actionStatus id="disconnect_status" >
            
            <apex:facet name="stop">
            <apex:pageblockSection id="ctgrs" title="Categories" columns="1">
                <!-- <apex:commandbutton value="ListCategories"  action="{!ListCategories2}" rerender="ctgrs,msgs" status="disconnect_status"/>  -->
                <apex:pageblockTable value="{!resData.category2}" var="data">
                    
                    <apex:column headerValue="Action" width="25%">
                    <apex:commandlink value="Edit" action="{!EditRow}" immediate="true" reRender="frms" rendered="{!!SaveRender}"/>&nbsp;&nbsp;&nbsp;
                  
                    <apex:commandlink onclick="if(!confirm('Are you sure?')) return;" action="{!deleteRow}" value="Remove" reRender="ctgrs">
                    <apex:param name="index" value="{!data.Id}" assignTo="{!rowIndex}"/>
                    </apex:commandlink>
                    
                    </apex:column> 
                    
                    <apex:column headerValue="Id" width="10%">
                          <apex:outputLink onclick="openPopup('/apex/ShowCategories2?id={!data.Id}&Name={!data.Name}&qty={!data.quantity}&price={!data.Price}&date={!data.date_created}')">{!data.Id}</apex:outputLink>
                    </apex:column>
                    
                    <apex:column headerValue="Name" width="25%">
                         <apex:outputText rendered="{!!SaveRender}">{!data.Name}</apex:outputText> 
                         <apex:inputText value="{!data.Name}" rendered="{!SaveRender}"></apex:inputText>                   
                    </apex:column>
                    <apex:column headerValue="Quantity" width="10%">
                         <apex:outputText rendered="{!!SaveRender}">{!data.quantity}</apex:outputText> 
                         <apex:inputText value="{!data.quantity}" rendered="{!SaveRender}"></apex:inputText>
                    </apex:column>
                    <apex:column headerValue="Price" width="10%">
                          <apex:outputText rendered="{!!SaveRender}">{!data.Price}</apex:outputText> 
                          <apex:inputText value="{!data.Price}" rendered="{!SaveRender}"></apex:inputText>
                          <apex:variable var="rowNumber" value="{!rowNumber + 1}" /> 
                    </apex:column>                        
                </apex:pageblockTable>           
                 
                <!-- <apex:commandbutton value="Refresh"  action="{!RefreshToken}" /> -->
                <!-- <apex:commandbutton value="Disconnect"  action="{!Disconnect}" rendered="{!!showConnectBtn}" rerender="msgs,ctgrs" status="disconnect_status"/>                          -->
            </apex:pageblockSection>  
        </apex:facet>
        </apex:actionStatus>    
        </apex:pageBlock>   
        </apex:form>
   <!-- </apex:pageBlock> -->
</apex:page>
 
Srinivas SSrinivas S
<apex:commandlink value="Edit" action="{!EditRow}" immediate="true" reRender="frms" rendered="{!!SaveRender}"/>
Please replace above line with below code and try it -
<apex:outputLink value="{!data.id}/e" id="theLink">Edit</apex:outputLink>

------------
Thanks,
Srinivas
- Please mark as solution if your problem is resolved.