Skip to content

Instantly share code, notes, and snippets.

View DataTable.app
<aura:application extends="force:slds">
<aura:attribute name="userData" type="List" default="[]"/>
<aura:attribute name="tableHeight" type="Integer" default="450"/>
<aura:attribute name="sortedDirection" type="String" default="DESC"/>
<aura:attribute name="inlineEdit" type="boolean" default="true"/>
<aura:attribute name="enableColAction" type="boolean" default="true"/>
<c:DataTableLazyLoading selectedData="{!v.userData}" tableHeight="{!v.tableHeight}"
sortedDirection="{!v.sortedDirection}" inlineEdit="{!v.inlineEdit}"
enableColAction ="{!v.enableColAction}"/>
View CustomSearch.cmp
<aura:component controller="CustomSearchController" implements="forceCommunity:searchInterface,force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global" >
<aura:attribute name="searchText" type="String" default=""/>
<aura:attribute type="list" name="recordList" />
<aura:attribute name="Label" type="String"/>
<aura:attribute name="required" type="Boolean" default="false"/>
<lightning:card iconName="utility:search" title="Global Search">
<div class="slds-form-element__control slds-input-has-icon slds-input-has-icon slds-input-has-icon_left-right" role="none">
<lightning:input required="{!v.required}" aura:id="userinput" label="{!v.Label}" name="searchText" onchange="{! c.handleClick }" value="{!v.searchText}" class="leftspace"/>
<span class="slds-icon_container slds-icon-utility-search slds-input__icon slds-input__icon_right iconheight">
View ChildContactMapController.apxc
public class ChildContactMapController {
@AuraEnabled
public static List<Address> contactAddressMap(String recordId) {
List<Address> adressList = new List<Address>();
List<Contact> conList = [SELECT ID, Name, MailingStreet, MailingCity, MailingState, MailingCountry, MailingPostalCode from Contact
WHERE AccountID =: recordId];
for(Contact con : conList) {
location location = new location(con.MailingStreet, con.MailingCity,con.MailingState,con.MailingCountry,con.MailingPostalCode);
adressList.add(new Address(location, con.Name));
View RecordEditFormComp.cmp
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global" >
<aura:attribute name="disabled" type="Boolean" default="false" />
<aura:attribute name="saved" type="Boolean" default="false" />
<aura:attribute name="showSpinner" type="Boolean" default="true" />
<aura:attribute name="sObjectName" type="String" default="Contact" />
<aura:attribute name="iconName" type="String" default="contact" />
<aura:attribute name="recordId" type="String" />
<aura:attribute name="pageReference" type="Object"/>
<lightning:navigation aura:id="navService"/>
View RecordFormComp.cmp
<aura:component controller="RecordFormCompController" implements="flexipage:availableForRecordHome,force:hasRecordId,force:apphostable" access="global">
<aura:attribute name="sObjectName" type="String" default="Account" />
<aura:attribute name="iconName" type="String" default="account" />
<aura:attribute name="recordId" type="Id"/>
<lightning:card iconName="{!'standard:'+v.iconName}" title="{! 'New '+v.sObjectName}">
<div class="slds-p-left_large slds-p-right_medium">
<lightning:recordForm
objectApiName="{!v.sObjectName}"
recordId="{!v.recordId}"
layoutType="Full"
View DataTableController.apex
public class DataTableController {
@AuraEnabled
public static DataTableWrapper initRecords(String ObjectName, String fieldNamesStr, String Orderby, String OrderDir) {
DataTableWrapper dtw = new DataTableWrapper();
List<LabelDescriptionWrapper> labelList = new List<LabelDescriptionWrapper>();
List<String> fieldSet = new List<String>();
Set<String> fieldNameSet = new Set<String>(fieldNamesStr.split(','));
View LookupComponent.CSS
.THIS .slds-leftpad{
padding-left: 2rem;
}
.THIS .iconheight{
top: 65%;
}
.THIS .leftspace input {
padding-left:2rem;
}
View SobjectComponent.js
({
doInit : function(component, event, helper) {
var sobject = component.get('v.objName');
var fieldName = component.get('v.fieldName');
var formatText = component.find("fielddata");
if(!fieldName.includes('.')) {
formatText.set("v.value",sobject[fieldName]);
}
else {
console.log(sobject[fieldName.split(".")[0]]);
View SobjectComponent.cmp
<aura:component >
<aura:attribute name="objName" type="String" />
<aura:attribute name="fieldName" type="String" />
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<lightning:formattedText aura:id="fielddata" />
</aura:component>
View sObjectDemo.controller
({
doInit : function(component, event, helper) {
var action = component.get("c.getsendObjectDetails");
action.setParams({ objName : component.get("v.objName") });
action.setCallback(this, function(response){
var state = response.getState();
if (state === "SUCCESS") {
//console.log("SUCCESS");
component.set("{!v.sObjects}", response.getReturnValue());
You can’t perform that action at this time.