This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global class FullCalendarDemo{ | |
@RemoteAction | |
global static List<User_Calendar__c> getEvents() { | |
String userId = UserInfo.getUserId() ; | |
List<User_Calendar__c> userCalendar = [SELECT Id, Name, User__r.Name, | |
Event__c, Event__r.Name, Event__r.Start_Time__c, Event__r.End_Time__c | |
FROM User_Calendar__c | |
WHERE User__c=:userId]; | |
if(userCalendar.size()>0){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Initializing fullcalendar with appropriate option and handlers | |
* using Singleton Pattern | |
* */ | |
const CalendarSingleton = (function(){ | |
let calendarInstance; | |
function createCalendar(){ | |
//Initialize Full Calender | |
//and render inside 'calendar' div |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" | |
controller="LightningMapDemoController" | |
access="global" > | |
<!-- datatable component attribute --> | |
<aura:attribute name="data" type="Object"/> | |
<aura:attribute name="columns" type="List"/> | |
<aura:attribute name="selectedRowsCount" type="Integer" default="0"/> | |
<aura:attribute name="maxRowSelection" type="Integer" default="5"/> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
/** | |
* Fetch car list on component initialization and | |
* generate datatable columns | |
* */ | |
doInit : function(component, event, helper) { | |
component.set('v.columns', [ | |
{label: 'Name', fieldName: 'Name', type: 'text'}, | |
{label: 'Build Year', fieldName: 'BuildYear', type: 'number'}, | |
{label: 'Rent/Day', fieldName: 'PerDayRent', type: 'currency', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
/** | |
* Get all cars from server | |
* */ | |
getCars : function(component, helper) { | |
//Call server action to get events | |
var action = component.get("c.getAllCars"); | |
action.setCallback(this, function(response) { | |
var state = response.getState(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LightningMapDemoController { | |
@AuraEnabled(cacheable=true) | |
public static List<CarWrapper> getAllCars(){ | |
List<Car__c> cars = [SELECT Id, Name, Available_For_Rent__c, Build_Year__c, | |
Mileage__c, Per_Day_Rent__c, | |
(SELECT Id, Name, City__c,Coordinates__Latitude__s, Coordinates__Longitude__s, | |
Country__c, Pin_Code__c, State__c, Street__c FROM Address__r) | |
FROM Car__c Limit 100]; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<aura:component access="global"> | |
<!-- ChannelName, which needs to subscribed --> | |
<aura:attribute name="channelName" type="String" required="true"/> | |
<!-- Save the reference of current subscription, which can be unsubscribe later on --> | |
<aura:attribute name="subscription" type="Object"/> | |
<!-- This event is fired when a component is destroyed. | |
Handle this event if you need to do custom cleanup when a component is destroyed.--> | |
<aura:handler name="destroy" value="{!this}" action="{!c.unsubscribe}"/> |