Skip to content

Instantly share code, notes, and snippets.

<aura:component>
<lightning:inputRichText value="HELLO">
<lightning:insertImageButton/>
</lightning:inputRichText>
</aura:component>
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes">
<lightning:navigation aura:id="navService"/>
<lightning:button label="Navigate" onclick="{!c.handleClick}"/>
</aura:component>
({
handleClick: function(cmp, event, helper) {
var navService = cmp.find("navService");
var pageReference = {
"type": "standard__component",
"attributes": {
"componentName": "c__WebinarOverride"
},
"state": {
'message':'This is the target page'
<aura:component implements="lightning:isUrlAddressable">
<aura:handler name="init" value="{!this}" action="{!c.doInIt}"/>
<lightning:card iconName="standard:event" title="WebinarOverride component">
<lightning:formattedText class="slds-p-left_small" value="This is the target page"/>
</lightning:card>
<lightning:card/>
</aura:component>
({
doInIt : function(component, event, helper) {
var id = component.get("v.pageReference").state.message;
var toastEvent=$A.get('e.force:showToast');
toastEvent.setParams({
title:'Rendering page',
message:id,
key:'info_alt',
type:'info',
mode:'pester'
<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global">
<aura:attribute name="fieldsArray" type="String[]"
default="['Name','Email','Phone','AccountId']" />
<aura:attribute name='recordId' type="Id" />
<lightning:recordForm aura:id="recordForm"
recordId="{!v.recordId}"
objectApiName="Contact"
fields="{!v.fieldsArray}"
public class ContactRecordListApex {
/**--------------------
Purpose: get list of contact records
-------------------------**/
@auraEnabled
public static list<Contact> getContacts(String recordId)
{
List<Contact> contactList=[select name, FirstName,LastName,Email,Phone from Contact where accountId=:recordId];
return contactList;
<aura:component controller="ContactRecordListApex" implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global">
<aura:attribute name="myData" type="Object"/>
<aura:attribute name="myColumns" type="List"/>
<aura:attribute name="recordId" type="string"/>
<aura:handler name="init" value="{!this}" action="{!c.init}"/>
<lightning:datatable data="{! v.myData }"
columns="{! v.myColumns }"
keyField="Id"
hideCheckboxColumn="false"
aura:id="contactDatatable"
({
init: function (cmp, event, helper) {
cmp.set('v.myColumns', [
{ label: 'Contact Name', fieldName: 'Name', type: 'text',editable: true},
{ label: 'Phone', fieldName: 'Phone', type: 'phone',editable: true},
{ label: 'Email', fieldName: 'Email', type: 'email',editable: true}
]);
helper.getData(cmp);
},
saveTable:function (cmp,event,helper)
({
getData : function(cmp) {
var action = cmp.get('c.getContacts');
var recordId=cmp.get('v.recordId');
action.setParams({recordId:recordId});
action.setCallback(this, $A.getCallback(function (response) {
var state = response.getState();
if (state === "SUCCESS") {
//console.log(JSON.stringify(response.getReturnValue()));
cmp.set('v.myData', response.getReturnValue());