2015-04-17 89 views
1

的javascript:展開所有切換,無需點擊

<script> 
     jQuery.noConflict(); 
     function toggleContactRow(rowId) { 
       var AccountImg = jQuery(document.getElementById(rowId + ":Img")); 
       var ContactsRow = jQuery(document.getElementById(rowId + ":Contact")); 
       ContactsRow.show(); 
} 
    </script> 

Visualforce:

<table id="tableAccount" class="list" border="0" cellpadding="0" cellspacing="0" > 
        <thead> 
         <tr class="headerRow"> 
         <th class="actionColumn">Action</th> 
          <th>Account Name</th> 
          <th>Industry</th> 
          <th>Billing Country</th> 
          <th>Createdby</th> 
         </tr> 
        </thead> 
        <tbody> 
        <apex:repeat id="repeatAccount" 
         value="{!accountList}" 
         var="item"> 
         <apex:variable var="acc" value="{!item.oAccount}" /> 
         <tr id="{!$Component.repeatAccount}:account" class="dataRow"> 
         <td class="actionColumn"> 
           <apex:inputcheckbox id="selectAccountRow" 
            value="{!item.IsSelected}" 
            onclick="javascript:toggleSelectAll(this, '{!$Component.repeatAccount}');"/> 
          </td> 
          <td class="dataCell"> 
           <apex:outputLink id="linkShowHide" value="javascript:toggleContactRow('{!$Component.repeatAccount}')"> 
            <img id="{!$Component.repeatAccount}:Img" src="/s.gif" class="showContacts" border="0" height="11px" width="11px" style="padding-right: 4px;"/> 
            <apex:outputField value="{!acc.Name}" /> 
           </apex:outputLink> 
          </td> 
          <td class="dataCell"><apex:outputField value="{!acc.name}" /></td> 
          <td class="dataCell"><apex:outputField value="{!acc.Accountid}" /></td> 
          <td class="dataCell"><apex:outputField value="{!acc.Id}" /></td> 
         </tr> 
         <tr id="{!$Component.repeatAccount}:Contact" class="dataRow" style="display:none;"> 
          <td colspan="100" style="padding:10px; padding-left: 45px;"> 
           <h3>son opportunity</h3> 
           <br/>           
           <apex:outputPanel layout="none">            
            <table id="tableAccountContacts" class="list" border="0" cellpadding="0" cellspacing="0"> 
             <thead> 
              <tr class="headerRow"> 
               <th class="actionColumn">Action</th> 
               <th>Name</th> 
               <th>Email</th> 
               <th>Phone</th> 
              </tr> 
             </thead> 
             <tbody> 
             <apex:repeat id="repeatAccountContacts" 
              value="{!item.contactSet}" 
              var="subitem"> 
              <apex:variable value="{!subitem.oContact}" var="con" /> 
              <tr class="dataRow"> 
               <td class="actionColumn"><apex:inputCheckbox id="selectContactRow" styleclass="ContactCheckbox" value="{!subitem.IsSelected}"/></td> 
               <td class="dataCell"><apex:outputField value="{!con.id}" /></td> 
               <td class="dataCell"><apex:outputField value="{!con.name}"/></td> 
               <td class="dataCell"><apex:outputField value="{!con.accountid}" /></td>               
              </tr> 
             </apex:repeat> 
             </tbody> 
            </table> 
           </apex:outputPanel> 
          </td> 
         </tr> 
        </apex:repeat> 
        </tbody> 
       </table> 

目前,它是擴大TD點擊切換後。 在visualforce頁的onload不接受。所以我必須在 VF頁的onclick保持,但我想顯示完整的擴展切換,當我打開我的網頁

幫我做這個enter image description here

我想說明項目擴展切換沒有點擊 我該怎麼做?

+0

你有關聯的任何class和id? – nirmal

回答

1

進行簡單的表演

$(document).ready(function() { 
    $('.dataRow').show(); 
}); 

作秀動畫

$(document).ready(function() { 
    $('.dataRow').slideDown(); 
});