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
You can download file directly from github by Click Here.
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]
<aura:application extends="force:slds">
<c:expandAndCollapseAllCmp/>
</aura:application>
Step 2:- Create Lightning Component : expandAndCollapseAllCmp.cmp
From Developer Console >> File >> New >> Lightning Component
expandAndCollapseAllCmp.cmp [Lightning Component File]
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
<div class="slds slds-p-horizontal--medium" style="font-size:11px;">
<div class="slds-scrollable--x">
<table class="slds-table slds-table_cell-buffer slds-table_bordered slds-no-row-hover episodicTbl" style="border:1px #ddd solid;">
<thead style="font-size:11px;">
<tr>
<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>
<th style="width:15%;">Student Name</th>
<th style="width:15%;">Father Name</th>
<th style="width:15%;">Phone</th>
<th style="width:15%;">Email</th>
<th style="width:40%;">Address</th>
<th><div style="width:100px;"></div></th>
</tr>
</thead>
<tbody id="loadDataInfo" class="loadDataInfo">
<c:expandAndCollapseDetailscmp/>
</tbody>
</table>
</div>
<br/><br/>
<!--Start RelatedTopics Section-->
<div style="border:1px #ddd solid; padding:10px; background:#eee; margin:40px 0;">
<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>
<br/><br/>
<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>
<div style="display:block; overflow:hidden;">
<div style="width: 50%; float:left; display:inline-block">
<ul style="list-style-type: square; font-size: 16px; margin: 0 0 0 54px; padding: 0;">
<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>
<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>
<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>
<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>
<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>
</ul>
</div>
<div style="width: 50%; float:left; display:inline-block">
<ul style="list-style-type: square; font-size: 16px; margin: 0 0 0 54px; padding: 0;">
<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>
<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>
<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>
<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>
<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>
</ul>
</div>
<div style="clear:both;"></div>
<br/>
<div class="youtubeIcon">
<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>
</div>
</div>
</div>
<!--End RelatedTopics Section-->
</div>
</aura:component>
Step 3:- Create Lightning Component : expandAndCollapseAllCmpController.js
From Developer Console >> File >> New >> Lightning Component >> JavaScript Controller
expandAndCollapseAllCmpController.js [JavaScript Controller]
({
moreDataInfo : function(component, event, helper) {
var thisObj = event.target.id;
var loadDataInfo = document.getElementById('loadDataInfo');
var rowDetailAll = loadDataInfo.querySelectorAll('.rowDetail');
var listRowAll = loadDataInfo.querySelectorAll('.listRow');
document.getElementById(thisObj).classList.toggle('activeIcon');
if(loadDataInfo.classList.contains('active') || loadDataInfo.classList.contains('loadDataInfo')){
for(var i=0; i<rowDetailAll.length; i++){
listRowAll[i].classList.remove('activeIcon');
rowDetailAll[i].classList.remove('activeRow');
}
}
loadDataInfo.classList.toggle('active');
},
})
Step 4:- Create Lightning Component : expandAndCollapseAllCmp.css
From Developer Console >> File >> New >> Lightning Component >> Component Style CSs
expandAndCollapseAllCmp.css [Style CSS]
.THIS {
background-color:#fff;
}
.THIS .episodicTbl {border-spacing: 0px;}
.THIS .episodicTbl TH{background:#0783dc; color:#fff;}
.THIS .episodicTbl th, .THIS .episodicTbl td{vertical-align:top; white-space: normal; padding: .30rem .5rem;}
.THIS .episodicTbl th:last-child, .THIS .episodicTbl td:last-child{padding-right:0;}
.THIS .episodicTbl td .slds-input, .THIS .episodicTbl td .slds-select{width:auto; line-height: 1.2rem; min-height: calc(1.2rem + 2px);}
.THIS .episodicTbl td .uiInput--textarea.textarea{padding: .12rem 0.3rem; width:100%;}
.THIS .episodicTbl td .slds-select{height: 13px; min-width:100px;}
.THIS .episodicTbl td .slds-input.epsInp{width:60px;}
.THIS .episodicTbl .updateBtnSpn .slds-button{min-width:75px; display:block; margin-bottom:5px; margin-left:0; text-align:left;}
.THIS .episodicTbl .updateBtnSpn:last-child{margin-bottom:0;}
.THIS .episodicTbl .rowCol{display:block;}
.THIS .episodicTbl .rowCol .inpFldSml{width:100%;}
.THIS .episodicTbl .rowCol .datePicker-openIcon{bottom: 4px;}
.THIS .episodicTbl .rowCol.dateInp .slds-dropdown-trigger{width: 115px;}
.THIS .episodicTbl .rowCol.dateInp input{ width:100%;}
.THIS .episodicTbl .rowCol.dateInp .slds-input-has-icon .slds-input__icon{top: 42%;}
.THIS .uiInputSelect .form-element__label{display:none;}
.THIS .episodicTbl th, .THIS .episodicTbl td{vertical-align:top; border-top:0;}
.THIS .episodicTbl td{padding-top:10px; padding-bottom: 4px;}
.THIS .episodicTbl .wrapText{max-width:70px; overflow:hidden; display:inline-block; text-overflow:ellipsis; white-space:nowrap;}
.THIS .episodicTbl tbody tr:hover{background:#f5f5f5;}
.THIS .slds-button.slds-button_brand{line-height: 1.3rem;}
.THIS .slds-lookup .slds-lookup__search-input{line-height: 1.6rem; min-height: calc(1.6rem + 2px);}
.THIS .slds-form-element_horizontal .slds-select {min-height: calc(1.6rem + (1px * 2));}
.THIS .episodicSubTbl TH{background:#c5c5c5; color:#000;}
.THIS .episodicSubTbl td:first-child{padding-left: 0.5rem;}
.THIS .episodicSubTbl td:last-child{padding-right: 0;}
.THIS .episodicSubTbl td{padding:2px; padding-bottom:0;}
.THIS .episodicSubTbl .rowCol{display:block; margin-bottom:5px; overflow:hidden;}
.THIS .episodicSubTbl .rowCol .inpFldSml{width:95px;}
.THIS .episodicSubTbl .rowCol .dateInp{width:115px;}
.THIS .episodicSubTbl .textArea{width:120px; padding: .6rem;}
.THIS .episodicSubTbl input.uiInput--checkbox[type=checkbox]{float:left; display: inline-block; margin-right: 5px;}
.THIS .septrLine{border-bottom:1px #999 solid !important;}
.THIS .listRow .dashIcon{display:none;}
.THIS .listRow.activeIcon .dashIcon{display:inline-block;}
.THIS .listRow.activeIcon .addIcon{display:none;}
.THIS .loadDataInfo tr.rowDetail:nth-child(odd){background: #eee;}
.THIS .loadDataInfo tr.rowDetail td{border-bottom:1px #ccc solid;}
.THIS .loadDataInfo{display: contents;}
.THIS .loadDataInfo .dataRowItem{display: none;}
.THIS .loadDataInfo .addIcon{display:inline-block;}
.THIS .loadDataInfo .dashIcon{display:none;}
.THIS .loadDataInfo .rowDetail.activeRow + .dataRowItem{display: contents;}
.THIS .loadDataInfo .rowDetail.activeRow .addIcon{display:none;}
.THIS .loadDataInfo .rowDetail.activeRow .dashIcon{display:inline-block;}
.THIS .loadDataInfo.active .dataRowItem{display: contents;}
.THIS .loadDataInfo.active .addIcon{display:none;}
.THIS .loadDataInfo.active .dashIcon{display:inline-block;}
.THIS .loadDataInfo.active .rowDetail.activeRow + .dataRowItem{display: none;}
.THIS .loadDataInfo.active .rowDetail.activeRow .addIcon{display:inline-block;}
.THIS .loadDataInfo.active .rowDetail.activeRow .dashIcon{display:none;}
.THIS .dataRowItem{display:none;}
.THIS .rowDetail.activeRow + .dataRowItem{display: contents;}
.THIS .actBtnOver{width:70px;}
.THIS .actBtnOver .slds-icon_x-small{width: 0.65rem; height: 0.65rem;}
.THIS .actBtnOver .slds-icon_container_circle{padding: .3rem;}
.THIS .actBtnOver .slds-button+.slds-button{margin-left: 0rem;}
.THIS .statusMarkOver{display:inline-block; padding-top: 3px;}
.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]
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
<!-- Start reportCardRow0 -->
<tr class="rowDetail" id="reportCardRow0">
<td>
<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>
</td>
<td>
<div class="rowSplit">
<div class="rowCol"><ui:inputText class="slds-input" value="" /></div>
</div>
</td>
<td>
<div class="rowCol"><ui:inputPhone class="slds-input" value="" /></div>
</td>
<td>
<div class="rowCol"><ui:inputEmail class="slds-input" value=""/> </div>
</td>
<td>
<div class="rowCol"><ui:inputText class="slds-input" value=""/></div>
</td>
<td><ui:inputTextArea class="slds-textarea textArea" aura:id="title" value="" rows="1"/></td>
<td>
<div class="actBtnOver">
<button class="slds-button slds-button_icon" title="Save" >
<lightning:icon iconName="action:record" size="x-small" alternativeText="Save"/>
<span class="slds-assistive-text" title="Ssave">save</span>
</button>
<a href="#" class="slds-button slds-button_icon" title="View" style="display: inline-block;">
<lightning:icon iconName="action:preview" size="x-small" alternativeText="View"/>
</a>
<button class="slds-button slds-button_icon" title="Delete Record" >
<lightning:icon iconName="action:delete" size="x-small" alternativeText="Delete"/>
<span class="slds-assistive-text" title="Delete">Delete</span>
</button>
</div>
</td>
</tr>
<tr class="dataRowItem">
<td colspan="7" class="septrLine">
<table class="slds-table slds-table_cell-buffer episodicSubTbl">
<tr>
<td width="10%">
<div class="rowSplit">
<div class="rowCol dateInp">
<lightning:input type="date" label="Exam Start Date" value="" />
</div>
<div class="rowCol dateInp">
<lightning:input style="width:100%" type="date" name="End" label="Exm End Date" value="" />
</div>
</div>
</td>
<td width="20%">
<div class="rowCol dateInp">
<lightning:input type="text" name="Class Teacher" label="Class Teacher" value="" />
</div>
<div class="rowCol dateInp">
<lightning:input type="text" name="Total Marks" label="Location" value="" />
</div>
</td>
<td width="10%">
<div class="rowSplit">
<div class="rowCol dateInp">
<lightning:input type="date" name="Seassion Start Date" label="Seassion Start Date" value="" />
</div>
<div class="rowCol dateInp">
<lightning:input type="date" name="Session Last Date " label="Session Last Date" value="" />
</div>
</div>
</td>
<td width="15%">
<div class="rowSplit slds-p-top--medium slds-m-left--medium">
<div class="rowCol slds-float--left slds-m-right--small"><label class="labelTxt">Hindi</label><ui:inputCheckbox value=""/></div>
<div class="rowCol "><label class="labelTxt">English</label><ui:inputCheckbox value=""/></div>
</div>
<div class="rowSplit slds-m-left--medium">
<div class="rowCol slds-float--left slds-m-right--small"><label class="labelTxt">Math</label><ui:inputCheckbox value=""/></div>
<div class="rowCol"><label class="labelTxt">Science</label><ui:inputCheckbox value=""/></div>
</div>
</td>
<td width="45%">
<div class="rowSplit">
<div class="rowCol slds-p-right--x-small">
<label class="labelTxt">Your Comments</label>
<ui:inputTextArea class="slds-textarea textArea" aura:id="Comments" value="" rows="2"/>
</div>
</div>
</td>
</tr>
</table>
</td>
</tr>
<!-- Start reportCardRow1 -->
<tr class="rowDetail" id="reportCardRow1">
<td>
<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>
</td>
<td>
<div class="rowSplit">
<div class="rowCol"><ui:inputText class="slds-input" value="" /></div>
</div>
</td>
<td>
<div class="rowCol"><ui:inputPhone class="slds-input" value="" /></div>
</td>
<td>
<div class="rowCol"><ui:inputEmail class="slds-input" value=""/> </div>
</td>
<td>
<div class="rowCol"><ui:inputText class="slds-input" value=""/></div>
</td>
<td><ui:inputTextArea class="slds-textarea textArea" aura:id="title" value="" rows="1"/></td>
<td>
<div class="actBtnOver">
<button class="slds-button slds-button_icon" title="Save" >
<lightning:icon iconName="action:record" size="x-small" alternativeText="Save"/>
<span class="slds-assistive-text">save</span>
</button>
<a href="#" class="slds-button slds-button_icon" title="View" style="display: inline-block;">
<lightning:icon iconName="action:preview" size="x-small" alternativeText="View"/>
</a>
<button class="slds-button slds-button_icon" title="Delete Record" >
<lightning:icon iconName="action:delete" size="x-small" alternativeText="Delete"/>
<span class="slds-assistive-text">Delete</span>
</button>
</div>
</td>
</tr>
<tr class="dataRowItem">
<td colspan="7" class="septrLine">
<table class="slds-table slds-table_cell-buffer episodicSubTbl">
<tr>
<td width="10%">
<div class="rowSplit">
<div class="rowCol dateInp">
<lightning:input type="date" label="Exam Start Date" value="" />
</div>
<div class="rowCol dateInp">
<lightning:input style="width:100%" type="date" name="End" label="Exm End Date" value="" />
</div>
</div>
</td>
<td width="20%">
<div class="rowCol dateInp">
<lightning:input type="text" name="Class Teacher" label="Class Teacher" value="" />
</div>
<div class="rowCol dateInp">
<lightning:input type="text" name="Total Marks" label="Location" value="" />
</div>
</td>
<td width="10%">
<div class="rowSplit">
<div class="rowCol dateInp">
<lightning:input type="date" name="Seassion Start Date" label="Seassion Start Date" value="" />
</div>
<div class="rowCol dateInp">
<lightning:input type="date" name="Session Last Date " label="Session Last Date" value="" />
</div>
</div>
</td>
<td width="15%">
<div class="rowSplit slds-p-top--medium slds-m-left--medium">
<div class="rowCol slds-float--left slds-m-right--small"><label class="labelTxt">Hindi</label><ui:inputCheckbox value=""/></div>
<div class="rowCol "><label class="labelTxt">English</label><ui:inputCheckbox value=""/></div>
</div>
<div class="rowSplit slds-m-left--medium">
<div class="rowCol slds-float--left slds-m-right--small"><label class="labelTxt">Math</label><ui:inputCheckbox value=""/></div>
<div class="rowCol"><label class="labelTxt">Science</label><ui:inputCheckbox value=""/></div>
</div>
</td>
<td width="45%">
<div class="rowSplit">
<div class="rowCol slds-p-right--x-small">
<label class="labelTxt">Your Comments</label>
<ui:inputTextArea class="slds-textarea textArea" aura:id="Comments" value="" rows="2"/>
</div>
</div>
</td>
</tr>
</table>
</td>
</tr>
<!-- Start reportCardRow2 -->
<tr class="rowDetail" id="reportCardRow2">
<td>
<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>
</td>
<td>
<div class="rowSplit">
<div class="rowCol"><ui:inputText class="slds-input" value="" /></div>
</div>
</td>
<td>
<div class="rowCol"><ui:inputPhone class="slds-input" value="" /></div>
</td>
<td>
<div class="rowCol"><ui:inputEmail class="slds-input" value=""/> </div>
</td>
<td>
<div class="rowCol"><ui:inputText class="slds-input" value=""/></div>
</td>
<td><ui:inputTextArea class="slds-textarea textArea" aura:id="title" value="" rows="1"/></td>
<td>
<div class="actBtnOver">
<button class="slds-button slds-button_icon" title="Save" >
<lightning:icon iconName="action:record" size="x-small" alternativeText="Save"/>
<span class="slds-assistive-text">save</span>
</button>
<a href="#" class="slds-button slds-button_icon" title="View" style="display: inline-block;">
<lightning:icon iconName="action:preview" size="x-small" alternativeText="View"/>
</a>
<button class="slds-button slds-button_icon" title="Delete Record" >
<lightning:icon iconName="action:delete" size="x-small" alternativeText="Delete"/>
<span class="slds-assistive-text">Delete</span>
</button>
</div>
</td>
</tr>
<tr class="dataRowItem">
<td colspan="7" class="septrLine">
<table class="slds-table slds-table_cell-buffer episodicSubTbl">
<tr>
<td width="10%">
<div class="rowSplit">
<div class="rowCol dateInp">
<lightning:input type="date" label="Exam Start Date" value="" />
</div>
<div class="rowCol dateInp">
<lightning:input style="width:100%" type="date" name="End" label="Exm End Date" value="" />
</div>
</div>
</td>
<td width="20%">
<div class="rowCol dateInp">
<lightning:input type="text" name="Class Teacher" label="Class Teacher" value="" />
</div>
<div class="rowCol dateInp">
<lightning:input type="text" name="Total Marks" label="Location" value="" />
</div>
</td>
<td width="10%">
<div class="rowSplit">
<div class="rowCol dateInp">
<lightning:input type="date" name="Seassion Start Date" label="Seassion Start Date" value="" />
</div>
<div class="rowCol dateInp">
<lightning:input type="date" name="Session Last Date " label="Session Last Date" value="" />
</div>
</div>
</td>
<td width="15%">
<div class="rowSplit slds-p-top--medium slds-m-left--medium">
<div class="rowCol slds-float--left slds-m-right--small"><label class="labelTxt">Hindi</label><ui:inputCheckbox value=""/></div>
<div class="rowCol "><label class="labelTxt">English</label><ui:inputCheckbox value=""/></div>
</div>
<div class="rowSplit slds-m-left--medium">
<div class="rowCol slds-float--left slds-m-right--small"><label class="labelTxt">Math</label><ui:inputCheckbox value=""/></div>
<div class="rowCol"><label class="labelTxt">Science</label><ui:inputCheckbox value=""/></div>
</div>
</td>
<td width="45%">
<div class="rowSplit">
<div class="rowCol slds-p-right--x-small">
<label class="labelTxt">Your Comments</label>
<ui:inputTextArea class="slds-textarea textArea" aura:id="Comments" value="" rows="2"/>
</div>
</div>
</td>
</tr>
</table>
</td>
</tr>
<!-- Start reportCardRow3 -->
<tr class="rowDetail" id="reportCardRow3">
<td>
<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>
</td>
<td>
<div class="rowSplit">
<div class="rowCol"><ui:inputText class="slds-input" value="" /></div>
</div>
</td>
<td>
<div class="rowCol"><ui:inputPhone class="slds-input" value="" /></div>
</td>
<td>
<div class="rowCol"><ui:inputEmail class="slds-input" value=""/> </div>
</td>
<td>
<div class="rowCol"><ui:inputText class="slds-input" value=""/></div>
</td>
<td><ui:inputTextArea class="slds-textarea textArea" aura:id="title" value="" rows="1"/></td>
<td>
<div class="actBtnOver">
<button class="slds-button slds-button_icon" title="Save" >
<lightning:icon iconName="action:record" size="x-small" alternativeText="Save"/>
<span class="slds-assistive-text">save</span>
</button>
<a href="#" class="slds-button slds-button_icon" title="View" style="display: inline-block;">
<lightning:icon iconName="action:preview" size="x-small" alternativeText="View"/>
</a>
<button class="slds-button slds-button_icon" title="Delete Record" >
<lightning:icon iconName="action:delete" size="x-small" alternativeText="Delete"/>
<span class="slds-assistive-text">Delete</span>
</button>
</div>
</td>
</tr>
<tr class="dataRowItem">
<td colspan="7" class="septrLine">
<table class="slds-table slds-table_cell-buffer episodicSubTbl">
<tr>
<td width="10%">
<div class="rowSplit">
<div class="rowCol dateInp">
<lightning:input type="date" label="Exam Start Date" value="" />
</div>
<div class="rowCol dateInp">
<lightning:input style="width:100%" type="date" name="End" label="Exm End Date" value="" />
</div>
</div>
</td>
<td width="20%">
<div class="rowCol dateInp">
<lightning:input type="text" name="Class Teacher" label="Class Teacher" value="" />
</div>
<div class="rowCol dateInp">
<lightning:input type="text" name="Total Marks" label="Location" value="" />
</div>
</td>
<td width="10%">
<div class="rowSplit">
<div class="rowCol dateInp">
<lightning:input type="date" name="Seassion Start Date" label="Seassion Start Date" value="" />
</div>
<div class="rowCol dateInp">
<lightning:input type="date" name="Session Last Date " label="Session Last Date" value="" />
</div>
</div>
</td>
<td width="15%">
<div class="rowSplit slds-p-top--medium slds-m-left--medium">
<div class="rowCol slds-float--left slds-m-right--small"><label class="labelTxt">Hindi</label><ui:inputCheckbox value=""/></div>
<div class="rowCol "><label class="labelTxt">English</label><ui:inputCheckbox value=""/></div>
</div>
<div class="rowSplit slds-m-left--medium">
<div class="rowCol slds-float--left slds-m-right--small"><label class="labelTxt">Math</label><ui:inputCheckbox value=""/></div>
<div class="rowCol"><label class="labelTxt">Science</label><ui:inputCheckbox value=""/></div>
</div>
</td>
<td width="45%">
<div class="rowSplit">
<div class="rowCol slds-p-right--x-small">
<label class="labelTxt">Your Comments</label>
<ui:inputTextArea class="slds-textarea textArea" aura:id="Comments" value="" rows="2"/>
</div>
</div>
</td>
</tr>
</table>
</td>
</tr>
<!-- Start reportCardRow4 -->
<tr class="rowDetail" id="reportCardRow4">
<td>
<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>
</td>
<td>
<div class="rowSplit">
<div class="rowCol"><ui:inputText class="slds-input" value="" /></div>
</div>
</td>
<td>
<div class="rowCol"><ui:inputPhone class="slds-input" value="" /></div>
</td>
<td>
<div class="rowCol"><ui:inputEmail class="slds-input" value=""/> </div>
</td>
<td>
<div class="rowCol"><ui:inputText class="slds-input" value=""/></div>
</td>
<td><ui:inputTextArea class="slds-textarea textArea" aura:id="title" value="" rows="1"/></td>
<td>
<div class="actBtnOver">
<button class="slds-button slds-button_icon" title="Save" >
<lightning:icon iconName="action:record" size="x-small" alternativeText="Save"/>
<span class="slds-assistive-text">save</span>
</button>
<a href="#" class="slds-button slds-button_icon" title="View" style="display: inline-block;">
<lightning:icon iconName="action:preview" size="x-small" alternativeText="View"/>
</a>
<button class="slds-button slds-button_icon" title="Delete Record" >
<lightning:icon iconName="action:delete" size="x-small" alternativeText="Delete"/>
<span class="slds-assistive-text">Delete</span>
</button>
</div>
</td>
</tr>
<tr class="dataRowItem">
<td colspan="7" class="septrLine">
<table class="slds-table slds-table_cell-buffer episodicSubTbl">
<tr>
<td width="10%">
<div class="rowSplit">
<div class="rowCol dateInp">
<lightning:input type="date" label="Exam Start Date" value="" />
</div>
<div class="rowCol dateInp">
<lightning:input style="width:100%" type="date" name="End" label="Exm End Date" value="" />
</div>
</div>
</td>
<td width="20%">
<div class="rowCol dateInp">
<lightning:input type="text" name="Class Teacher" label="Class Teacher" value="" />
</div>
<div class="rowCol dateInp">
<lightning:input type="text" name="Total Marks" label="Location" value="" />
</div>
</td>
<td width="10%">
<div class="rowSplit">
<div class="rowCol dateInp">
<lightning:input type="date" name="Seassion Start Date" label="Seassion Start Date" value="" />
</div>
<div class="rowCol dateInp">
<lightning:input type="date" name="Session Last Date " label="Session Last Date" value="" />
</div>
</div>
</td>
<td width="15%">
<div class="rowSplit slds-p-top--medium slds-m-left--medium">
<div class="rowCol slds-float--left slds-m-right--small"><label class="labelTxt">Hindi</label><ui:inputCheckbox value=""/></div>
<div class="rowCol "><label class="labelTxt">English</label><ui:inputCheckbox value=""/></div>
</div>
<div class="rowSplit slds-m-left--medium">
<div class="rowCol slds-float--left slds-m-right--small"><label class="labelTxt">Math</label><ui:inputCheckbox value=""/></div>
<div class="rowCol"><label class="labelTxt">Science</label><ui:inputCheckbox value=""/></div>
</div>
</td>
<td width="45%">
<div class="rowSplit">
<div class="rowCol slds-p-right--x-small">
<label class="labelTxt">Your Comments</label>
<ui:inputTextArea class="slds-textarea textArea" aura:id="Comments" value="" rows="2"/>
</div>
</div>
</td>
</tr>
</table>
</td>
</tr>
</aura:component>
Step 6:- Create Lightning Component : expandAndCollapseDetailscmpController.js
From Developer Console >> File >> New >> Lightning Component >> JavaScript Controller
expandAndCollapseDetailscmpController.js [JavaScript Controller]
({
detailInfo : function(component, event, helper) {
var thisObj = event.target.name;
document.getElementById(thisObj).classList.toggle('activeRow');
},
})
Further post that would you like to learn in Salesforce
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 |