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
imrohitimrohit 

i am showing table on my vf page using apex:repeat now i want to show that

<table id="myDummyTable" class="slds-table slds-table--bordered  tablesorter">
                                <thead>
                                    <tr class="slds-text-title--caps headerRow">
                                        <apex:repeat value="{! headerList }" var="headerVar" id="theaddrs"  >                          
                                            <th scope="col" >
                                                {!headerVar}                                                                                       
                                            </th>
                                        </apex:repeat>                            
                                    </tr>
                                </thead> 
                                <tbody>  
                                    <apex:variable var="count" value="{!1}"/>
                                    
                                        <apex:repeat value="{! sObjectList }" var="ct"  >  
                                            <tr id="tr1">
                                                
                                                    <apex:repeat value="{!fieldList}" var="fieldVar">
                                                        <td>  
                                                            <div id = "td1">
                                                                <apex:outputField  value="{!ct[fieldVar]}"  />                                                                                                   
                                                            </div>
                                                            <div id = "td2">
                                                                <apex:inputField  value="{!ct[fieldVar]}"  />
                                                            </div>
                                                        </td>                                           
                                                        <apex:variable value="{!count+1}" var="count"/> 
                                                    </apex:repeat> 
                                               
                                               
                                            </tr> 
                                        </apex:repeat> 
                                  
                                    
                                </tbody>                                                           
                            </table>
table data should be display as read only but whenever i click on particular td that td should become editable i am doing this by add and remove class but it is applying only on my first td of my table
.hideClass{
            display:none;
            }   
.showClass{
            display:block;
            }

j$('#td2').addClass('hideClass');
            j$('#td1').dblclick(function(){
                alert("in dblclick");
                j$('#td1').addClass('hideClass');
                j$('#td2').removeClass('hideClass');
            });

Please suggest changes that should i do 
Thanks
 
Prady01Prady01
Hello there, The reason for "but it is applying only on my first td of my table" below

On double click you calling the fucntion and harcoding the values. Every double click will only add hidecalss but you also need to remove the other CSS class that is showing the <td></td>

j$('#td1').addClass('hideClass');
j$('#td2').removeClass('hideClass');


The more easy'est way would be to use pageblock table and use inline edit fucntionality that rools out with pageblock table.

Hope this helps!

Thanks,
Prady01
imrohitimrohit
hello prady01
Thanks for giving time to my problem 
but actully i want to solve my problem without using apex:inlineeditsupporty that's why i was trying to solve this by custom adding and removing classes