Skip to content

Instantly share code, notes, and snippets.

View kishoreBandanadam's full-sized avatar

kishoreBandanadam

View GitHub Profile
<aura:component controller="ContactController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
<aura:attribute name="myContact" type="Map"/>
<aura:attribute name="icon" type="String"/>
<aura:attribute name="object" type="String"/>
<aura:handler name="init" value="{!this}" action="{!c.doinit}"/>
<aura:registerEvent name="LookupEventToParent" type="c:LookupEventToParent"/>
<li role="presentation" class="slds-listbox__item " onclick ="{!c.onOptionClick}">
<div id="option1" class="slds-media slds-listbox__option slds-listbox__option_entity slds-media_center" role="option">
public with sharing class dynamicRowsController {
@AuraEnabled
public static void saveAccountsLwc(List<account> records){
if(records.size()>0 && records != null){
List<account> accs = new List<account>();
for(integer i = 0; i < records.size(); i++) {
account acc = new account();
acc.Id = records[i].Id;
<aura:event type="APPLICATION" description="Event template" />
<!-- DeleteNotifyComponentEvent -->
<aura:event type="COMPONENT" description="Event template">
</aura:event>
<aura:event type="COMPONENT" description="delete row">
<aura:attribute name="rowIndex" type="Integer"/>
</aura:event>
<!-- DeleteAttachmentsEvent -->
<aura:event type="APPLICATION" description="Event template">
<aura:attribute name="toDeleteIds" type="Object[]"/>
</aura:event>
<!-- LookupEventToParent -->
<aura:event type="COMPONENT" description="Event template">
<aura:attribute name="selectedItem" type="Map"/>
</aura:event>
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lwcListEditable">
<apiVersion>45.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__AppPage</target>
<target>lightning__RecordPage</target>
<target>lightning__HomePage</target>
</targets>
</LightningComponentBundle>
/* eslint-disable @lwc/lwc/no-async-operation */
/* eslint-disable no-console */
import { LightningElement, track } from 'lwc';
import saveAccountsLwc from '@salesforce/apex/dynamicRowsController.saveAccountsLwc';
import getAccounts from '@salesforce/apex/dynamicRowsController.getAccounts';
import deleteAccounts from '@salesforce/apex/dynamicRowsController.deleteAccounts';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
export default class LwcListEditable extends LightningElement {
<template>
<lightning-card title="LWC Table">
<lightning-button-icon icon-name="utility:add" slot="actions" onclick={add}></lightning-button-icon>
<lightning-button
label={toggleSaveLabel}
icon-name="utility:save"
slot="actions"
onclick={handleSave}>
</lightning-button>
<lightning-button