Skip to content

Instantly share code, notes, and snippets.

View Sunil02kumar's full-sized avatar

Sunil Kumar Sunil02kumar

View GitHub Profile
@Sunil02kumar
Sunil02kumar / SK_DataTableFreezeHeaderDemoApp.app
Created February 12, 2018 16:41
Datatable header Freeze Demo
<aura:application extends="force:slds">
<c:SK_DataTableFreezeHeaderDemoCmp />
</aura:application>
@Sunil02kumar
Sunil02kumar / SK_ChartJsCmp.cmp
Last active January 30, 2018 02:56
Using Chartjs in Lightning Components
<aura:component controller="SK_ChartJsCmpController">
<aura:attribute name="ltngChartData" type="Object"/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<div class="slds-grid slds-wrap">
<div class="slds-size--1-of-1 slds-medium-size--1-of-1 slds-large-size--1-of-1" >
<div class="slds-card__body slds-card__body_inner" aura:id="lineChartSection"/>
</div>
<div class="slds-size--1-of-1 slds-medium-size--1-of-1 slds-large-size--1-of-1" >
<div class="slds-card__body slds-card__body_inner" aura:id="horrizontalBarChartSection"/>
<apex:page sidebar="false" standardStylesheets="false" docType="html-5.0" id="sk" showHeader="false">
<head>
<apex:slds />
</head>
<body class="slds-scope">
<div class="slds-grid slds-wrap" id="fileSelectionPopUpDiv">
<div class="slds-col slds-size--1-of-1 slds-small-size--1-of-2 slds-medium-size--1-of-2 slds-col">
<div class="slds-align_absolute-center">
<aura:component controller="SK_DemoSF1EventsCmpController" implements="force:appHostable" >
<aura:attribute name="recList" type="List" />
<aura:attribute name="menu" type="List" default="View,Edit" description="Optional Menu Items"/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<aura:handler event="aura:waiting" action="{!c.showSpinner}"/>
<aura:handler event="aura:doneWaiting" action="{!c.hideSpinner}"/>
<div class="slds-align--absolute-center">
<lightning:spinner aura:id="spinner" variant="brand" size="large" class="slds=hide"/>
</div>
<aura:application extends="force:slds">
<c:SK_LightningTreeCmp ltngcurrentRecId="0019000000ld4kO"
ltngSobjectname="Account"
ltngParentFieldAPIName="ParentId"
ltngLabelFieldAPIName="Name"
ltngHierarchyHeader="Account Hierarchy"/>
<c:SK_LightningTreeCmp ltngcurrentRecId="5009000000GJkJG"
ltngSobjectname="Case"
@Sunil02kumar
Sunil02kumar / SK_SLDSShowHide.cmp
Created August 29, 2017 15:00
Lightning Component to display slds-show and slds-hide behavior
<aura:component >
<aura:attribute name="displayedSection" type="string" default=""/>
<div>
<b> This component is going to explain div slds show-hide functionality</b>
</div>
<lightning:button label="Display Section 1" variant="brand" onclick="{!c.displaySection1}"/>
<lightning:button label="Display Section 2" variant="brand" onclick="{!c.displaySection2}"/>
<div aura:id="firstsection" class="{!if(v.displayedSection == 'section1','slds-show','slds-hide')}">
<div>
<b> First Div Section</b>
@Sunil02kumar
Sunil02kumar / SK_AuraIfCmp.cmp
Last active August 29, 2017 15:01
Lightning Component to display Aura:if tag behavior
<aura:component >
<aura:attribute name="displayedSection" type="string" default=""/>
<div>
<b> This component is going to explain aura:if tag functionality</b>
</div>
<lightning:button label="Display Section 1" variant="brand" onclick="{!c.displaySection1}"/>
<lightning:button label="Display Section 2" variant="brand" onclick="{!c.displaySection2}"/>
<aura:if isTrue="{!v.displayedSection == 'section1'}">
<div aura:id="firstsection">
<lightning:input type="text" label="Section 1 input" name="sec1"
@RestResource(urlMapping='/RestAPIDemo/*')
global class SK_RestAPIDemoController {
@HttpGet
global static List<Account> searchAccounts() {
String cName = RestContext.request.params.get('searchString');
string searchName = '%' + cName + '%';
List<Account> accList = new List<Account>();
accList = [ Select ID, Name, Type,Industry, BillingCountry from Account where Name Like : searchName];
return accList;
}
@Sunil02kumar
Sunil02kumar / SK_LocalizationDemo.vf
Created July 28, 2017 06:13
Language Translation in VisualForce Page
<apex:page standardcontroller="Account" extensions="SK_LocalizationDemoController" language="{!selectedLang}" sidebar="false">
<apex:form >
<div >
<div style="float:right">
<apex:selectList value="{!selectedLang}" size="1">
<apex:selectoptions value="{!AvailableLanguages}"/>
<apex:actionsupport event="onchange"/>
</apex:selectlist>
</div>
</div>
@Sunil02kumar
Sunil02kumar / SK_AccountList.cmp
Last active July 20, 2017 13:25
Inheritance in Lightning Components
<aura:component controller="SK_AccountListController" extends="c:SK_CallToServerUtility">
<aura:attribute type="Object" name="returnedRecords" />
<aura:attribute type="string" name="searchValue" default="" />
<aura:set attribute="msg" value="SK_CallToServerUtility component is inherited in SK_AccountList Component"/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<div>
<div class="slds-align--absolute-center">
Inherited Component attribute (msg) value set by this component:<b>{!v.msg}</b>
</div>
<br/>