Skip to content

Instantly share code, notes, and snippets.

View choudharymanish8585's full-sized avatar
💭
Never Settle

Manish Choudhari choudharymanish8585

💭
Never Settle
View GitHub Profile
.THIS .diet-veg{
background : yellowgreen;
}
.THIS .diet-nveg{
background : orangered;
color : white;
}
.THIS .working-true{
background : rebeccapurple;
color : white;
({
/**
* Init function
* setup columns and data in this function
* @author Manish Choudhari
* */
doInit : function(component, event, helper) {
//Let's configure the columns of the data table
component.set('v.columns', [
//Key here is cellAttributes object for Particular column
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" access="global" >
<!-- attributes -->
<aura:attribute name="data" type="Object"/>
<aura:attribute name="columns" type="List"/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<!-- A very simple data table -->
<lightning:datatable
keyField="id"
data="{! v.data }"
({
doInit : function(component, event, helper) {
const options=[{'Id':1,'Name':'Jaipur'},
{'Id':2,'Name':'Pune'},
{'Id':3,'Name':'Hyderabad'},
{'Id':4,'Name':'Banglore'},
{'Id':5,'Name':'Gurgaon'},
{'Id':6,'Name':'Mumbai'},
{'Id':7,'Name':'Chennai'},
{'Id':8,'Name':'Noida'},
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" access="global" >
<aura:attribute name="options" type="List" />
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<!--invoking MultiSelect component -->
<c:MultiSelect mslabel="Job Location" msoptions="{!v.options}" />
</aura:component>
({
onInit : function(component,event,helper) {
component.find("service").getNewRecord(
"Car_Experience__c", // sObject type (entityAPIName)
null, // recordTypeId
false, // skip cache?
$A.getCallback(function() {
var rec = component.get("v.carExperience");
var error = component.get("v.recordError");
var car=component.get("v.car");
({
doInit : function(component, event, helper) {
helper.onInit(component, event, helper);
},
/*
* This function is called when the experience is saved
* */
onSave: function(component, event, helper) {
component.set("v.carExperience.Car__c", component.get("v.car.Id"));
<aura:component extends="c:Base">
<aura:attribute type="Car__c" name="car" access="public" />
<aura:attribute type="Car_Experience__c" name="carExperience" access="public" />
<!-- Attribute to capture error thrown by Lighting Data Service -->
<aura:attribute name="recordError" type="String" access="private" />
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<aura:registerEvent name="carExpAdded" type="c:CarExpAdded" />
({
onCarSelected : function(component, event, helper) {
component.set("v.Id", event.getParam("car").Id);
component.set("v.showComponent", true);
/*
* handle record change;
* reloadRecord will cause you to lose your current record,
* including any changes you’ve made
* */
component.find("service").reloadRecord();
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes">
<aura:attribute type="Id" name="Id" access="public" />
<aura:attribute type="Car__c" name="car" access="public" />
<aura:attribute name="recordError" type="String" access="private" />
<!-- this attribute will hold the value of selected tab -->
<aura:attribute type="Id" name="tabId" access="public" />
<aura:attribute type="boolean" name="showComponent" default="false" />