Create custom expand all/ collapse all for accordion section rows table based in lightning component | how to create expand/collapse in lightning component Salesforce

2,780 views

Hey guys, today in this post we are going to learn about how to create a custom expandable all/collapsible all (Accordion) rows table based in lightning component.

Files we used in this post example

expandAndCollapseAllapp.app Lightning Application It is used for call the component to preview on browser.

expandAndCollapseAllCmp.cmp

Lightning Component It is used for create a table of student Information.
expandAndCollapseAllCmpController.js Lightning Component Controller

Β It is used for click functionality expandable all/ Collapsible all section..

expandAndCollapseAllCmp.css Component Style CSS It is used for creat a custom style CSS for alignmnet expandable/Collapsible section table
expandAndCollapseDetailscmp.cmp Lightning Component It is a child component of ‘expandAndCollapseAllCmp.cmp’
expandAndCollapseDetailscmpController.js Lightning Component Controller It is used for expand and collapse functionality in row section detail view.

 

Live Demo

expand all collapse all rows in lightning component -- w3web.net

 

You can download file directly from github by Click Here.

Why Should You Schedule Meeting?

🎯 If You Are Facing Any Of These 6 Challenges. Schedule Meeting With Me.

  • Learn Salesforce Development
  • Career Confusion
  • No Interview Call
  • Low Salary
  • No Promotion/Growth
  • No Finding New Job Opportunity
  • Why you stucking from past so many years in same company?

 

 

 

Other related post that would you like to learn in Salesforce

 

 

Step 1:- Create Lightning Application : expandAndCollapseAllapp.app

From Developer Console >> File >> New >> Lightning Application

expandAndCollapseAllapp.app [Component Application File]

  1.   <aura:application extends="force:slds">
  2.     <c:expandAndCollapseAllCmp/>
  3.  </aura:application>

Step 2:- Create Lightning Component : expandAndCollapseAllCmp.cmp

From Developer Console >> File >> New >> Lightning Component

expandAndCollapseAllCmp.cmp [Lightning Component File]

  1.    <aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
  2.         <div class="slds slds-p-horizontal--medium" style="font-size:11px;">        
  3.         <div class="slds-scrollable--x"> 
  4.             <table class="slds-table slds-table_cell-buffer slds-table_bordered slds-no-row-hover episodicTbl" style="border:1px #ddd solid;">
  5.                 <thead style="font-size:11px;">
  6.                     <tr>
  7.                         <th><div style="width:20px;"><span class="slds-m-right--x-small listRow" id="listRow" onclick="{!c.moreDataInfo}"><lightning:icon iconName="utility:add" variant="inverse" size="xx-small" class="addIcon" style="cursor:pointer;"/> <lightning:icon iconName="utility:dash" variant="inverse" size="xx-small" class="dashIcon" style="cursor:pointer;"/></span></div></th>
  8.                         <th style="width:15%;">Student Name</th>
  9.                         <th style="width:15%;">Father Name</th>
  10.                         <th style="width:15%;">Phone</th>    
  11.                         <th style="width:15%;">Email</th>
  12.                         <th style="width:40%;">Address</th>   
  13.                         <th><div style="width:100px;"></div></th>
  14.                     </tr>
  15.                 </thead>
  16.                 <tbody id="loadDataInfo" class="loadDataInfo">                    
  17.                     <c:expandAndCollapseDetailscmp/>
  18.                 </tbody>
  19.             </table>
  20.         </div>
  21. <br/><br/>
  22.    <!--Start RelatedTopics Section-->
  23. <div style="border:1px #ddd solid; padding:10px; background:#eee; margin:40px 0;">
  24.  
  25.             <p data-aura-rendered-by="435:0"><img src="https://www.w3web.net/wp-content/uploads/2021/05/thumbsUpLike.png" width="25" height="25" style="vertical-align:top; margin-right:10px;" data-aura-rendered-by="436:0"><strong data-aura-rendered-by="437:0"><span style="font-size:16px; font-style:italic; display:inline-block; margin-right:5px;">Don't forget to check out:-</span><a href="https://www.w3web.net/" target="_blank" rel="noopener noreferrer" style="text-decoration:none;" data-aura-rendered-by="440:0">An easy way to learn step-by-step online free Salesforce tutorial, To know more Click  <span style="color:#ff8000; font-size:18px;" data-aura-rendered-by="442:0">Here..</span></a></strong></p>
  26.  
  27.             <br/><br/>
  28.             <p data-aura-rendered-by="435:0"><img src="https://www.w3web.net/wp-content/uploads/2021/07/tickMarkIcon.png" width="25" height="25" style="vertical-align:top; margin-right:10px;" data-aura-rendered-by="436:0"><strong data-aura-rendered-by="437:0"><span style="font-size:17px; font-style:italic; display:inline-block; margin-right:5px; color:rgb(255 128 0);">You May Also Like β†’</span> </strong></p>
  29.             <div style="display:block; overflow:hidden;"> 
  30.                 <div style="width: 50%; float:left; display:inline-block">
  31.                     <ul style="list-style-type: square; font-size: 16px; margin: 0 0 0 54px; padding: 0;"> 
  32.                         <li><a href="https://www.w3web.net/lwc-get-set-lightning-checkbox-value/" target="_blank" rel="noopener noreferrer">How to get selected checkbox value in lwc</a></li>
  33.                         <li><a href="https://www.w3web.net/display-account-related-contacts-in-lwc/" target="_blank" rel="noopener noreferrer">how to display account related contacts based on AccountId in lwc</a></li>
  34.                         <li><a href="https://www.w3web.net/create-lightning-datatable-row-actions-in-lwc/" target="_blank" rel="noopener noreferrer">how to create lightning datatable row actions in lwc</a></li>
  35.                         <li><a href="https://www.w3web.net/if-and-else-condition-in-lwc/" target="_blank" rel="noopener noreferrer">how to use if and else condition in lwc</a></li>
  36.                         <li><a href="https://www.w3web.net/get-selected-radio-button-value-and-checked-default-in-lwc/" target="_blank" rel="noopener noreferrer">how to display selected radio button value in lwc</a></li>
  37.                     </ul>
  38.             </div>
  39.  
  40.             <div style="width: 50%; float:left; display:inline-block">
  41.                     <ul style="list-style-type: square; font-size: 16px; margin: 0 0 0 54px; padding: 0;"> 
  42.                        <li><a href="https://www.w3web.net/update-parent-object-from-child/" target="_blank" rel="noopener noreferrer">update parent field from child using apex trigger</a></li>
  43.                         <li><a href="https://www.w3web.net/display-account-related-contacts-lwc/" target="_blank" rel="noopener noreferrer">display account related contacts based on account name in lwc</a></li>
  44.                         <li><a href="https://www.w3web.net/create-lightning-datatable-row-actions-in-lwc/" target="_blank" rel="noopener noreferrer">how to insert a record of account Using apex class in LWC</a></li>
  45.                         <li><a href="https://www.w3web.net/fetch-picklist-values-dynamic-in-lwc/" target="_blank" rel="noopener noreferrer">how to get picklist values dynamically in lwc</a></li>
  46.                         <li><a href="https://www.w3web.net/edit-save-and-remove-rows-dynamically-in-lightning-component/" target="_blank" rel="noopener noreferrer">how to edit/save row dynamically in lightning component</a></li>
  47.  
  48.                     </ul>
  49.                 </div>
  50.                <div style="clear:both;"></div> 
  51.                <br/>
  52.                 <div class="youtubeIcon">
  53.                     <a href="https://www.youtube.com/channel/UCW62gTen2zniILj9xE6LmOg" target="_blank" rel="noopener noreferrer"><img src="https://www.w3web.net/wp-content/uploads/2021/11/youtubeIcon.png" width="25" height="25" style="vertical-align:top; margin-right:10px;"/> <strong>TechW3web:-</strong> To know more, Use this <span style="color: #ff8000; font-weight: bold;">Link</span> </a>
  54.                 </div>
  55.     </div>
  56.  
  57. </div>
  58.  
  59.   <!--End RelatedTopics Section-->
  60.  
  61.     </div>   
  62. </aura:component>

 

Step 3:- Create Lightning Component : expandAndCollapseAllCmpController.js

From Developer Console >> File >> New >> Lightning Component >> JavaScript Controller

expandAndCollapseAllCmpController.js [JavaScript Controller]

  1.   ({      
  2.     moreDataInfo : function(component, event, helper) {
  3. 		var thisObj = event.target.id;
  4.         var loadDataInfo = document.getElementById('loadDataInfo');
  5.         var rowDetailAll =  loadDataInfo.querySelectorAll('.rowDetail');
  6.         var listRowAll =  loadDataInfo.querySelectorAll('.listRow');
  7.         document.getElementById(thisObj).classList.toggle('activeIcon');            
  8.             if(loadDataInfo.classList.contains('active') || loadDataInfo.classList.contains('loadDataInfo')){
  9.                 for(var i=0; i<rowDetailAll.length; i++){
  10.                   listRowAll[i].classList.remove('activeIcon');  
  11.                   rowDetailAll[i].classList.remove('activeRow');
  12.                }
  13.             }           
  14.  
  15.         loadDataInfo.classList.toggle('active');
  16. 	},
  17.  
  18. })

 

Step 4:- Create Lightning Component : expandAndCollapseAllCmp.css

From Developer Console >> File >> New >> Lightning Component >> Component Style CSs

expandAndCollapseAllCmp.css [Style CSS]

  1.   .THIS {
  2.     background-color:#fff;
  3. }
  4. .THIS .episodicTbl {border-spacing: 0px;}
  5. .THIS .episodicTbl TH{background:#0783dc; color:#fff;}
  6. .THIS .episodicTbl th, .THIS .episodicTbl td{vertical-align:top; white-space: normal; padding: .30rem .5rem;}
  7. .THIS .episodicTbl th:last-child, .THIS .episodicTbl td:last-child{padding-right:0;}
  8. .THIS .episodicTbl td .slds-input, .THIS .episodicTbl td .slds-select{width:auto; line-height: 1.2rem; min-height: calc(1.2rem + 2px);}
  9. .THIS .episodicTbl td .uiInput--textarea.textarea{padding: .12rem 0.3rem; width:100%;}
  10. .THIS .episodicTbl td .slds-select{height: 13px; min-width:100px;}
  11. .THIS .episodicTbl td .slds-input.epsInp{width:60px;}
  12. .THIS .episodicTbl .updateBtnSpn .slds-button{min-width:75px; display:block; margin-bottom:5px; margin-left:0; text-align:left;}
  13. .THIS .episodicTbl .updateBtnSpn:last-child{margin-bottom:0;}
  14. .THIS .episodicTbl .rowCol{display:block;}
  15. .THIS .episodicTbl .rowCol .inpFldSml{width:100%;}
  16. .THIS .episodicTbl .rowCol .datePicker-openIcon{bottom: 4px;}
  17. .THIS .episodicTbl .rowCol.dateInp .slds-dropdown-trigger{width: 115px;}
  18. .THIS .episodicTbl .rowCol.dateInp input{ width:100%;}
  19. .THIS .episodicTbl .rowCol.dateInp .slds-input-has-icon .slds-input__icon{top: 42%;}
  20. .THIS .uiInputSelect .form-element__label{display:none;}
  21.  
  22. .THIS .episodicTbl th, .THIS .episodicTbl td{vertical-align:top; border-top:0;}
  23. .THIS .episodicTbl td{padding-top:10px; padding-bottom: 4px;}
  24. .THIS .episodicTbl .wrapText{max-width:70px; overflow:hidden; display:inline-block; text-overflow:ellipsis; white-space:nowrap;}
  25.  
  26. .THIS .episodicTbl tbody tr:hover{background:#f5f5f5;}
  27. .THIS .slds-button.slds-button_brand{line-height: 1.3rem;}
  28. .THIS .slds-lookup .slds-lookup__search-input{line-height: 1.6rem; min-height: calc(1.6rem + 2px);}
  29. .THIS .slds-form-element_horizontal .slds-select {min-height: calc(1.6rem + (1px * 2));}
  30.  
  31. .THIS .episodicSubTbl TH{background:#c5c5c5; color:#000;}
  32. .THIS .episodicSubTbl td:first-child{padding-left: 0.5rem;}
  33. .THIS .episodicSubTbl td:last-child{padding-right: 0;}
  34. .THIS .episodicSubTbl td{padding:2px; padding-bottom:0;}
  35. .THIS .episodicSubTbl .rowCol{display:block; margin-bottom:5px; overflow:hidden;}
  36. .THIS .episodicSubTbl .rowCol .inpFldSml{width:95px;}
  37. .THIS .episodicSubTbl .rowCol .dateInp{width:115px;}
  38. .THIS .episodicSubTbl .textArea{width:120px; padding: .6rem;}
  39. .THIS .episodicSubTbl input.uiInput--checkbox[type=checkbox]{float:left; display: inline-block; margin-right: 5px;}
  40. .THIS .septrLine{border-bottom:1px #999 solid !important;}
  41.  
  42. .THIS .listRow .dashIcon{display:none;}
  43. .THIS .listRow.activeIcon .dashIcon{display:inline-block;}
  44. .THIS .listRow.activeIcon .addIcon{display:none;}
  45.  
  46. .THIS .loadDataInfo tr.rowDetail:nth-child(odd){background: #eee;} 
  47. .THIS .loadDataInfo tr.rowDetail td{border-bottom:1px #ccc solid;}
  48.  
  49. .THIS .loadDataInfo{display: contents;}
  50.  
  51. .THIS .loadDataInfo .dataRowItem{display: none;}
  52. .THIS .loadDataInfo .addIcon{display:inline-block;}
  53. .THIS .loadDataInfo .dashIcon{display:none;}
  54.  
  55. .THIS .loadDataInfo .rowDetail.activeRow + .dataRowItem{display: contents;}
  56. .THIS .loadDataInfo .rowDetail.activeRow .addIcon{display:none;}
  57. .THIS .loadDataInfo .rowDetail.activeRow .dashIcon{display:inline-block;}
  58.  
  59. .THIS .loadDataInfo.active .dataRowItem{display: contents;}
  60. .THIS .loadDataInfo.active .addIcon{display:none;}
  61. .THIS .loadDataInfo.active .dashIcon{display:inline-block;}
  62.  
  63. .THIS .loadDataInfo.active .rowDetail.activeRow + .dataRowItem{display: none;}
  64. .THIS .loadDataInfo.active .rowDetail.activeRow .addIcon{display:inline-block;}
  65. .THIS .loadDataInfo.active .rowDetail.activeRow .dashIcon{display:none;}
  66.  
  67. .THIS .dataRowItem{display:none;}
  68. .THIS .rowDetail.activeRow + .dataRowItem{display: contents;}
  69. .THIS .actBtnOver{width:70px;}
  70. .THIS .actBtnOver .slds-icon_x-small{width: 0.65rem; height: 0.65rem;}
  71. .THIS .actBtnOver .slds-icon_container_circle{padding: .3rem;}
  72. .THIS .actBtnOver .slds-button+.slds-button{margin-left: 0rem;}
  73. .THIS .statusMarkOver{display:inline-block; padding-top: 3px;}
  74. .THIS .statusMarkOver .statusMark{display:inline-block; font-weight:bold; margin:0 0 1px 2px; padding:1px 2px; font-size:11px;}

 

Step 5:- Create Lightning Component : expandAndCollapseDetailscmp.cmp

From Developer Console >> File >> New >> Lightning Component

expandAndCollapseDetailscmp.cmp [Lightning Component File]

  1.    <aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
  2. 	<!-- Start reportCardRow0 -->
  3.     <tr class="rowDetail" id="reportCardRow0">  
  4.         <td>
  5.             <span class="slds-m-right--x-small listRow" name="reportCardRow0" aura:id="spanIcon" onclick="{!c.detailInfo}"><lightning:icon iconName="utility:add" class="addIcon"  size="xx-small" style="cursor:pointer;" /> <lightning:icon iconName="utility:dash" size="xx-small" class="dashIcon" style="cursor:pointer;"/></span>
  6.         </td>
  7.         <td>            
  8.             <div class="rowSplit">
  9.                 <div class="rowCol"><ui:inputText class="slds-input" value="" /></div>
  10.             </div>
  11.         </td>
  12.         <td>
  13.             <div class="rowCol"><ui:inputPhone class="slds-input" value="" /></div>
  14.         </td>
  15.         <td>
  16.             <div class="rowCol"><ui:inputEmail class="slds-input" value=""/> </div>
  17.         </td>
  18.         <td>
  19.             <div class="rowCol"><ui:inputText class="slds-input" value=""/></div>
  20.         </td>
  21.  
  22.         <td><ui:inputTextArea class="slds-textarea textArea" aura:id="title" value="" rows="1"/></td>
  23.         <td>
  24.             <div class="actBtnOver">   
  25.  
  26.                 <button class="slds-button slds-button_icon" title="Save" >
  27.                     <lightning:icon iconName="action:record" size="x-small" alternativeText="Save"/>
  28.                     <span class="slds-assistive-text" title="Ssave">save</span>
  29.                 </button>
  30.  
  31.                 <a  href="#" class="slds-button slds-button_icon" title="View" style="display: inline-block;">
  32.                     <lightning:icon iconName="action:preview" size="x-small" alternativeText="View"/> 
  33.                 </a>
  34.  
  35.                 <button class="slds-button slds-button_icon" title="Delete Record" >
  36.                     <lightning:icon iconName="action:delete" size="x-small" alternativeText="Delete"/>
  37.                     <span class="slds-assistive-text" title="Delete">Delete</span>
  38.                 </button>
  39.             </div>            
  40.         </td>  
  41.     </tr>
  42.  
  43.     <tr class="dataRowItem"> 
  44.         <td colspan="7" class="septrLine">
  45.             <table class="slds-table slds-table_cell-buffer episodicSubTbl">
  46.  
  47.                 <tr>
  48.                     <td width="10%">
  49.                         <div class="rowSplit">
  50.                             <div class="rowCol dateInp">
  51.                                 <lightning:input type="date" label="Exam Start Date" value="" />
  52.                             </div>
  53.                             <div class="rowCol dateInp">                                
  54.                                 <lightning:input style="width:100%" type="date" name="End" label="Exm End Date" value="" />
  55.                             </div>
  56.                         </div>
  57.                     </td>
  58.                     <td width="20%">                        
  59.                         <div class="rowCol dateInp">                            
  60.                             <lightning:input type="text" name="Class Teacher" label="Class Teacher" value="" />
  61.                         </div>
  62.                         <div class="rowCol dateInp">                            
  63.                              <lightning:input type="text" name="Total Marks" label="Location" value="" />
  64.                         </div>
  65.                     </td>
  66.  
  67.                     <td width="10%">
  68.                         <div class="rowSplit">                            
  69.                             <div class="rowCol dateInp">
  70.                                 <lightning:input type="date" name="Seassion Start Date" label="Seassion Start Date" value="" />
  71.                             </div>
  72.                             <div class="rowCol dateInp"> 
  73.                                  <lightning:input type="date" name="Session Last Date " label="Session Last Date" value="" />
  74.                             </div> 
  75.                         </div>
  76.  
  77.                     </td>
  78.                     <td width="15%">                    
  79.                         <div class="rowSplit slds-p-top--medium slds-m-left--medium">                            
  80.                             <div class="rowCol slds-float--left slds-m-right--small"><label class="labelTxt">Hindi</label><ui:inputCheckbox value=""/></div>
  81.                             <div class="rowCol "><label class="labelTxt">English</label><ui:inputCheckbox value=""/></div> 
  82.  
  83.                         </div>
  84.                         <div class="rowSplit slds-m-left--medium">
  85.                             <div class="rowCol slds-float--left slds-m-right--small"><label class="labelTxt">Math</label><ui:inputCheckbox value=""/></div> 
  86.                             <div class="rowCol"><label class="labelTxt">Science</label><ui:inputCheckbox value=""/></div> 
  87.                         </div>
  88.                     </td>
  89.  
  90.                     <td width="45%">                    
  91.                         <div class="rowSplit">                            
  92.                             <div class="rowCol slds-p-right--x-small">
  93.                                 <label class="labelTxt">Your Comments</label>
  94.                                 <ui:inputTextArea class="slds-textarea textArea" aura:id="Comments" value="" rows="2"/>
  95.                             </div>
  96.                         </div>
  97.                     </td>
  98.                 </tr>
  99.             </table>
  100.         </td>
  101.     </tr>
  102.  
  103.     <!-- Start reportCardRow1 -->
  104.     <tr class="rowDetail" id="reportCardRow1">  
  105.         <td>
  106.             <span class="slds-m-right--x-small listRow" name="reportCardRow1" aura:id="spanIcon" onclick="{!c.detailInfo}"><lightning:icon iconName="utility:add" class="addIcon"  size="xx-small" style="cursor:pointer;" /> <lightning:icon iconName="utility:dash" size="xx-small" class="dashIcon" style="cursor:pointer;"/></span>
  107.         </td>
  108.         <td>            
  109.             <div class="rowSplit">
  110.                 <div class="rowCol"><ui:inputText class="slds-input" value="" /></div>
  111.             </div>
  112.         </td>
  113.         <td>
  114.             <div class="rowCol"><ui:inputPhone class="slds-input" value="" /></div>
  115.         </td>
  116.         <td>
  117.             <div class="rowCol"><ui:inputEmail class="slds-input" value=""/> </div>
  118.         </td>
  119.         <td>
  120.             <div class="rowCol"><ui:inputText class="slds-input" value=""/></div>
  121.         </td>
  122.  
  123.         <td><ui:inputTextArea class="slds-textarea textArea" aura:id="title" value="" rows="1"/></td>
  124.         <td>
  125.             <div class="actBtnOver">   
  126.  
  127.                 <button class="slds-button slds-button_icon" title="Save" >
  128.                     <lightning:icon iconName="action:record" size="x-small" alternativeText="Save"/>
  129.                     <span class="slds-assistive-text">save</span>
  130.                 </button>
  131.  
  132.                 <a  href="#" class="slds-button slds-button_icon" title="View" style="display: inline-block;">
  133.                     <lightning:icon iconName="action:preview" size="x-small" alternativeText="View"/> 
  134.                 </a>
  135.  
  136.                 <button class="slds-button slds-button_icon" title="Delete Record" >
  137.                     <lightning:icon iconName="action:delete" size="x-small" alternativeText="Delete"/>
  138.                     <span class="slds-assistive-text">Delete</span>
  139.                 </button>
  140.             </div>            
  141.         </td>  
  142.     </tr>
  143.  
  144.     <tr class="dataRowItem"> 
  145.         <td colspan="7" class="septrLine">
  146.             <table class="slds-table slds-table_cell-buffer episodicSubTbl">
  147.  
  148.                 <tr>
  149.                     <td width="10%">
  150.                         <div class="rowSplit">
  151.                             <div class="rowCol dateInp">
  152.                                 <lightning:input type="date" label="Exam Start Date" value="" />
  153.                             </div>
  154.                             <div class="rowCol dateInp">                                
  155.                                 <lightning:input style="width:100%" type="date" name="End" label="Exm End Date" value="" />
  156.                             </div>
  157.                         </div>
  158.                     </td>
  159.                     <td width="20%">                        
  160.                         <div class="rowCol dateInp">                            
  161.                             <lightning:input type="text" name="Class Teacher" label="Class Teacher" value="" />
  162.                         </div>
  163.                         <div class="rowCol dateInp">                            
  164.                              <lightning:input type="text" name="Total Marks" label="Location" value="" />
  165.                         </div>
  166.                     </td>
  167.  
  168.                     <td width="10%">
  169.                         <div class="rowSplit">                            
  170.                             <div class="rowCol dateInp">
  171.                                 <lightning:input type="date" name="Seassion Start Date" label="Seassion Start Date" value="" />
  172.                             </div>
  173.                             <div class="rowCol dateInp"> 
  174.                                  <lightning:input type="date" name="Session Last Date " label="Session Last Date" value="" />
  175.                             </div> 
  176.                         </div>
  177.  
  178.                     </td>
  179.                     <td width="15%">                    
  180.                         <div class="rowSplit slds-p-top--medium slds-m-left--medium">                            
  181.                             <div class="rowCol slds-float--left slds-m-right--small"><label class="labelTxt">Hindi</label><ui:inputCheckbox value=""/></div>
  182.                             <div class="rowCol "><label class="labelTxt">English</label><ui:inputCheckbox value=""/></div> 
  183.  
  184.                         </div>
  185.                         <div class="rowSplit slds-m-left--medium">
  186.                             <div class="rowCol slds-float--left slds-m-right--small"><label class="labelTxt">Math</label><ui:inputCheckbox value=""/></div> 
  187.                             <div class="rowCol"><label class="labelTxt">Science</label><ui:inputCheckbox value=""/></div> 
  188.                         </div>
  189.                     </td>
  190.  
  191.                     <td width="45%">                    
  192.                         <div class="rowSplit">                            
  193.                             <div class="rowCol slds-p-right--x-small">
  194.                                 <label class="labelTxt">Your Comments</label>
  195.                                 <ui:inputTextArea class="slds-textarea textArea" aura:id="Comments" value="" rows="2"/>
  196.                             </div>
  197.                         </div>
  198.                     </td>
  199.                 </tr>
  200.             </table>
  201.         </td>
  202.     </tr>
  203.  
  204.     <!-- Start reportCardRow2 -->
  205.     <tr class="rowDetail" id="reportCardRow2">  
  206.         <td>
  207.             <span class="slds-m-right--x-small listRow" name="reportCardRow2" aura:id="spanIcon" onclick="{!c.detailInfo}"><lightning:icon iconName="utility:add" class="addIcon"  size="xx-small" style="cursor:pointer;" /> <lightning:icon iconName="utility:dash" size="xx-small" class="dashIcon" style="cursor:pointer;"/></span>
  208.         </td>
  209.         <td>            
  210.             <div class="rowSplit">
  211.                 <div class="rowCol"><ui:inputText class="slds-input" value="" /></div>
  212.             </div>
  213.         </td>
  214.         <td>
  215.             <div class="rowCol"><ui:inputPhone class="slds-input" value="" /></div>
  216.         </td>
  217.         <td>
  218.             <div class="rowCol"><ui:inputEmail class="slds-input" value=""/> </div>
  219.         </td>
  220.         <td>
  221.             <div class="rowCol"><ui:inputText class="slds-input" value=""/></div>
  222.         </td>
  223.  
  224.         <td><ui:inputTextArea class="slds-textarea textArea" aura:id="title" value="" rows="1"/></td>
  225.         <td>
  226.             <div class="actBtnOver">   
  227.  
  228.                 <button class="slds-button slds-button_icon" title="Save" >
  229.                     <lightning:icon iconName="action:record" size="x-small" alternativeText="Save"/>
  230.                     <span class="slds-assistive-text">save</span>
  231.                 </button>
  232.  
  233.                 <a  href="#" class="slds-button slds-button_icon" title="View" style="display: inline-block;">
  234.                     <lightning:icon iconName="action:preview" size="x-small" alternativeText="View"/> 
  235.                 </a>
  236.  
  237.                 <button class="slds-button slds-button_icon" title="Delete Record" >
  238.                     <lightning:icon iconName="action:delete" size="x-small" alternativeText="Delete"/>
  239.                     <span class="slds-assistive-text">Delete</span>
  240.                 </button>
  241.             </div>            
  242.         </td>  
  243.     </tr>
  244.  
  245.     <tr class="dataRowItem"> 
  246.         <td colspan="7" class="septrLine">
  247.             <table class="slds-table slds-table_cell-buffer episodicSubTbl">
  248.  
  249.                 <tr>
  250.                     <td width="10%">
  251.                         <div class="rowSplit">
  252.                             <div class="rowCol dateInp">
  253.                                 <lightning:input type="date" label="Exam Start Date" value="" />
  254.                             </div>
  255.                             <div class="rowCol dateInp">                                
  256.                                 <lightning:input style="width:100%" type="date" name="End" label="Exm End Date" value="" />
  257.                             </div>
  258.                         </div>
  259.                     </td>
  260.                     <td width="20%">                        
  261.                         <div class="rowCol dateInp">                            
  262.                             <lightning:input type="text" name="Class Teacher" label="Class Teacher" value="" />
  263.                         </div>
  264.                         <div class="rowCol dateInp">                            
  265.                              <lightning:input type="text" name="Total Marks" label="Location" value="" />
  266.                         </div>
  267.                     </td>
  268.  
  269.                     <td width="10%">
  270.                         <div class="rowSplit">                            
  271.                             <div class="rowCol dateInp">
  272.                                 <lightning:input type="date" name="Seassion Start Date" label="Seassion Start Date" value="" />
  273.                             </div>
  274.                             <div class="rowCol dateInp"> 
  275.                                  <lightning:input type="date" name="Session Last Date " label="Session Last Date" value="" />
  276.                             </div> 
  277.                         </div>
  278.  
  279.                     </td>
  280.                     <td width="15%">                    
  281.                         <div class="rowSplit slds-p-top--medium slds-m-left--medium">                            
  282.                             <div class="rowCol slds-float--left slds-m-right--small"><label class="labelTxt">Hindi</label><ui:inputCheckbox value=""/></div>
  283.                             <div class="rowCol "><label class="labelTxt">English</label><ui:inputCheckbox value=""/></div> 
  284.  
  285.                         </div>
  286.                         <div class="rowSplit slds-m-left--medium">
  287.                             <div class="rowCol slds-float--left slds-m-right--small"><label class="labelTxt">Math</label><ui:inputCheckbox value=""/></div> 
  288.                             <div class="rowCol"><label class="labelTxt">Science</label><ui:inputCheckbox value=""/></div> 
  289.                         </div>
  290.                     </td>
  291.  
  292.                     <td width="45%">                    
  293.                         <div class="rowSplit">                            
  294.                             <div class="rowCol slds-p-right--x-small">
  295.                                 <label class="labelTxt">Your Comments</label>
  296.                                 <ui:inputTextArea class="slds-textarea textArea" aura:id="Comments" value="" rows="2"/>
  297.                             </div>
  298.                         </div>
  299.                     </td>
  300.                 </tr>
  301.             </table>
  302.         </td>
  303.     </tr>
  304.  
  305.   <!-- Start reportCardRow3 -->
  306.     <tr class="rowDetail" id="reportCardRow3">  
  307.         <td>
  308.             <span class="slds-m-right--x-small listRow" name="reportCardRow3" aura:id="spanIcon" onclick="{!c.detailInfo}"><lightning:icon iconName="utility:add" class="addIcon"  size="xx-small" style="cursor:pointer;" /> <lightning:icon iconName="utility:dash" size="xx-small" class="dashIcon" style="cursor:pointer;"/></span>
  309.         </td>
  310.         <td>            
  311.             <div class="rowSplit">
  312.                 <div class="rowCol"><ui:inputText class="slds-input" value="" /></div>
  313.             </div>
  314.         </td>
  315.         <td>
  316.             <div class="rowCol"><ui:inputPhone class="slds-input" value="" /></div>
  317.         </td>
  318.         <td>
  319.             <div class="rowCol"><ui:inputEmail class="slds-input" value=""/> </div>
  320.         </td>
  321.         <td>
  322.             <div class="rowCol"><ui:inputText class="slds-input" value=""/></div>
  323.         </td>
  324.  
  325.         <td><ui:inputTextArea class="slds-textarea textArea" aura:id="title" value="" rows="1"/></td>
  326.         <td>
  327.             <div class="actBtnOver">   
  328.  
  329.                 <button class="slds-button slds-button_icon" title="Save" >
  330.                     <lightning:icon iconName="action:record" size="x-small" alternativeText="Save"/>
  331.                     <span class="slds-assistive-text">save</span>
  332.                 </button>
  333.  
  334.                 <a  href="#" class="slds-button slds-button_icon" title="View" style="display: inline-block;">
  335.                     <lightning:icon iconName="action:preview" size="x-small" alternativeText="View"/> 
  336.                 </a>
  337.  
  338.                 <button class="slds-button slds-button_icon" title="Delete Record" >
  339.                     <lightning:icon iconName="action:delete" size="x-small" alternativeText="Delete"/>
  340.                     <span class="slds-assistive-text">Delete</span>
  341.                 </button>
  342.             </div>            
  343.         </td>  
  344.     </tr>
  345.  
  346.     <tr class="dataRowItem"> 
  347.         <td colspan="7" class="septrLine">
  348.             <table class="slds-table slds-table_cell-buffer episodicSubTbl">
  349.  
  350.                 <tr>
  351.                     <td width="10%">
  352.                         <div class="rowSplit">
  353.                             <div class="rowCol dateInp">
  354.                                 <lightning:input type="date" label="Exam Start Date" value="" />
  355.                             </div>
  356.                             <div class="rowCol dateInp">                                
  357.                                 <lightning:input style="width:100%" type="date" name="End" label="Exm End Date" value="" />
  358.                             </div>
  359.                         </div>
  360.                     </td>
  361.                     <td width="20%">                        
  362.                         <div class="rowCol dateInp">                            
  363.                             <lightning:input type="text" name="Class Teacher" label="Class Teacher" value="" />
  364.                         </div>
  365.                         <div class="rowCol dateInp">                            
  366.                              <lightning:input type="text" name="Total Marks" label="Location" value="" />
  367.                         </div>
  368.                     </td>
  369.  
  370.                     <td width="10%">
  371.                         <div class="rowSplit">                            
  372.                             <div class="rowCol dateInp">
  373.                                 <lightning:input type="date" name="Seassion Start Date" label="Seassion Start Date" value="" />
  374.                             </div>
  375.                             <div class="rowCol dateInp"> 
  376.                                  <lightning:input type="date" name="Session Last Date " label="Session Last Date" value="" />
  377.                             </div> 
  378.                         </div>
  379.  
  380.                     </td>
  381.                     <td width="15%">                    
  382.                         <div class="rowSplit slds-p-top--medium slds-m-left--medium">                            
  383.                             <div class="rowCol slds-float--left slds-m-right--small"><label class="labelTxt">Hindi</label><ui:inputCheckbox value=""/></div>
  384.                             <div class="rowCol "><label class="labelTxt">English</label><ui:inputCheckbox value=""/></div> 
  385.  
  386.                         </div>
  387.                         <div class="rowSplit slds-m-left--medium">
  388.                             <div class="rowCol slds-float--left slds-m-right--small"><label class="labelTxt">Math</label><ui:inputCheckbox value=""/></div> 
  389.                             <div class="rowCol"><label class="labelTxt">Science</label><ui:inputCheckbox value=""/></div> 
  390.                         </div>
  391.                     </td>
  392.  
  393.                     <td width="45%">                    
  394.                         <div class="rowSplit">                            
  395.                             <div class="rowCol slds-p-right--x-small">
  396.                                 <label class="labelTxt">Your Comments</label>
  397.                                 <ui:inputTextArea class="slds-textarea textArea" aura:id="Comments" value="" rows="2"/>
  398.                             </div>
  399.                         </div>
  400.                     </td>
  401.                 </tr>
  402.             </table>
  403.         </td>
  404.     </tr> 
  405.  
  406.     <!-- Start reportCardRow4 -->
  407.     <tr class="rowDetail" id="reportCardRow4">  
  408.         <td>
  409.             <span class="slds-m-right--x-small listRow" name="reportCardRow4" aura:id="spanIcon" onclick="{!c.detailInfo}"><lightning:icon iconName="utility:add" class="addIcon"  size="xx-small" style="cursor:pointer;" /> <lightning:icon iconName="utility:dash" size="xx-small" class="dashIcon" style="cursor:pointer;"/></span>
  410.         </td>
  411.         <td>            
  412.             <div class="rowSplit">
  413.                 <div class="rowCol"><ui:inputText class="slds-input" value="" /></div>
  414.             </div>
  415.         </td>
  416.         <td>
  417.             <div class="rowCol"><ui:inputPhone class="slds-input" value="" /></div>
  418.         </td>
  419.         <td>
  420.             <div class="rowCol"><ui:inputEmail class="slds-input" value=""/> </div>
  421.         </td>
  422.         <td>
  423.             <div class="rowCol"><ui:inputText class="slds-input" value=""/></div>
  424.         </td>
  425.  
  426.         <td><ui:inputTextArea class="slds-textarea textArea" aura:id="title" value="" rows="1"/></td>
  427.         <td>
  428.             <div class="actBtnOver">   
  429.  
  430.                 <button class="slds-button slds-button_icon" title="Save" >
  431.                     <lightning:icon iconName="action:record" size="x-small" alternativeText="Save"/>
  432.                     <span class="slds-assistive-text">save</span>
  433.                 </button>
  434.  
  435.                 <a  href="#" class="slds-button slds-button_icon" title="View" style="display: inline-block;">
  436.                     <lightning:icon iconName="action:preview" size="x-small" alternativeText="View"/> 
  437.                 </a>
  438.  
  439.                 <button class="slds-button slds-button_icon" title="Delete Record" >
  440.                     <lightning:icon iconName="action:delete" size="x-small" alternativeText="Delete"/>
  441.                     <span class="slds-assistive-text">Delete</span>
  442.                 </button>
  443.             </div>            
  444.         </td>  
  445.     </tr>
  446.  
  447.     <tr class="dataRowItem"> 
  448.         <td colspan="7" class="septrLine">
  449.             <table class="slds-table slds-table_cell-buffer episodicSubTbl">
  450.  
  451.                 <tr>
  452.                     <td width="10%">
  453.                         <div class="rowSplit">
  454.                             <div class="rowCol dateInp">
  455.                                 <lightning:input type="date" label="Exam Start Date" value="" />
  456.                             </div>
  457.                             <div class="rowCol dateInp">                                
  458.                                 <lightning:input style="width:100%" type="date" name="End" label="Exm End Date" value="" />
  459.                             </div>
  460.                         </div>
  461.                     </td>
  462.                     <td width="20%">                        
  463.                         <div class="rowCol dateInp">                            
  464.                             <lightning:input type="text" name="Class Teacher" label="Class Teacher" value="" />
  465.                         </div>
  466.                         <div class="rowCol dateInp">                            
  467.                              <lightning:input type="text" name="Total Marks" label="Location" value="" />
  468.                         </div>
  469.                     </td>
  470.  
  471.                     <td width="10%">
  472.                         <div class="rowSplit">                            
  473.                             <div class="rowCol dateInp">
  474.                                 <lightning:input type="date" name="Seassion Start Date" label="Seassion Start Date" value="" />
  475.                             </div>
  476.                             <div class="rowCol dateInp"> 
  477.                                  <lightning:input type="date" name="Session Last Date " label="Session Last Date" value="" />
  478.                             </div> 
  479.                         </div>
  480.  
  481.                     </td>
  482.                     <td width="15%">                    
  483.                         <div class="rowSplit slds-p-top--medium slds-m-left--medium">                            
  484.                             <div class="rowCol slds-float--left slds-m-right--small"><label class="labelTxt">Hindi</label><ui:inputCheckbox value=""/></div>
  485.                             <div class="rowCol "><label class="labelTxt">English</label><ui:inputCheckbox value=""/></div> 
  486.  
  487.                         </div>
  488.                         <div class="rowSplit slds-m-left--medium">
  489.                             <div class="rowCol slds-float--left slds-m-right--small"><label class="labelTxt">Math</label><ui:inputCheckbox value=""/></div> 
  490.                             <div class="rowCol"><label class="labelTxt">Science</label><ui:inputCheckbox value=""/></div> 
  491.                         </div>
  492.                     </td>
  493.  
  494.                     <td width="45%">                    
  495.                         <div class="rowSplit">                            
  496.                             <div class="rowCol slds-p-right--x-small">
  497.                                 <label class="labelTxt">Your Comments</label>
  498.                                 <ui:inputTextArea class="slds-textarea textArea" aura:id="Comments" value="" rows="2"/>
  499.                             </div>
  500.                         </div>
  501.                     </td>
  502.                 </tr>
  503.             </table>
  504.         </td>
  505.     </tr>
  506.  
  507. </aura:component>

 

Step 6:- Create Lightning Component : expandAndCollapseDetailscmpController.js

From Developer Console >> File >> New >> Lightning Component >> JavaScript Controller

expandAndCollapseDetailscmpController.js [JavaScript Controller]

  1.    ({   
  2.  
  3.      detailInfo : function(component, event, helper) {
  4.          var thisObj = event.target.name;         
  5.          document.getElementById(thisObj).classList.toggle('activeRow');  
  6.      },    
  7.  
  8. })

 

expand all collapse all rows in lightning component -- w3web.net

 
 

Further post that would you like to learn in Salesforce

 
 

 

 

FAQ (Frequently Asked Questions)

How do I show popups in Salesforce?

On a Salesforce record page, click and select Edit Page . Alternatively, open the page that you want to add the PopUp component to in Community Builder. Drag and drop the PopUp component to the page. In this example, we are adding a pop-up to an Account record.

How do I show popups in Salesforce lightning?

To display modal popup in your component first create a button in your Component which will be used to show & hide modal popup. True & False value. Copy and paste below code after button in your component. As you can see I am using aura if tag before popup.

What is modal box in Salesforce?

Modals/Popup Box are used to display content in a layer above the app. This paradigm is used in cases such as the creation or editing of a record, as well as various types of messaging and wizards.

Related Topics | You May Also Like

 
  

Our Free Courses β†’

πŸ‘‰ Get Free Course β†’

πŸ“Œ Salesforce Administrators

πŸ“Œ Salesforce Lightning Flow Builder

πŸ“Œ Salesforce Record Trigger Flow Builder

πŸ‘‰ Get Free Course β†’

πŸ“Œ Aura Lightning Framework

πŸ“Œ Lightning Web Component (LWC)

πŸ“Œ Rest APIs Integration




Hi, This is Vijay Kumar behind the admin and founder of w3web.net. I am a senior software developer and working in MNC company from more than 8 years. I am great fan of technology, configuration, customization & development. Apart of this, I love to write about Blogging in spare time, Working on Mobile & Web application development, Salesforce lightning, Salesforce LWC and Salesforce Integration development in full time. [Read full bio] | | The Sitemap where you can find all published post on w3web.net

Leave a Comment