This file contains 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
<template> | |
<lightning-record-edit-form | |
object-api-name="Account"> | |
<lightning-input-field | |
field-name="Name" value={name}></lightning-input-field> | |
</lightning-record-edit-form> | |
<lightning-button label="Click to change name" variant="brand" onclick={handleClick}></lightning-button> |
This file contains 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
/** | |
* Everything is pass by value in Apex. | |
* When a method is called the runtime pushes a stackframe on the stack and params | |
* are created as local vars, including ref vars. | |
* The object that the ref var points to lives on the heap and can be modified if not immutable. | |
* The param itself is the ref var and is by value like all params in Apex. | |
*/ | |
public class A { | |
public String val { get; set; } | |
} |
This file contains 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 > | |
<ltng:require scripts="/resource/rating/vendor/jquery.js,/resource/rating/lib/jquery.raty.js" | |
styles="/resource/rating/lib/jquery.raty.css" | |
afterScriptsLoaded="{!c.afterScriptsLoaded}"/> | |
<aura:attribute name="value" type="Integer" required="true"/> | |
<aura:attribute name="ready" type="Boolean" default="false"/> | |
<div aura:id="rating"></div> | |
</aura:component> |
This file contains 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 RestRequestController { | |
@AuraEnabled | |
public static Response service(String path, String method, String responseFormat, String bodyContent, String bodyContentType) { | |
HttpRequest request = buildRequest(path, method, responseFormat, bodyContent, bodyContentType); | |
HttpResponse httpRes = sendRequest(request); | |
Response restRes = buildResponse(httpRes); | |
return restRes; | |
} |
This file contains 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:event type="COMPONENT" description="Event fired when a file is selected"> | |
<aura:attribute name="file" type="Object" | |
description="The file file input element that has the selected file"/> | |
</aura:event> |
This file contains 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 FileController { | |
@AuraEnabled | |
public static Id saveTheFile(Id parentId, String fileName, String base64Data, String contentType) { | |
base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8'); | |
Attachment a = new Attachment(); | |
a.parentId = parentId; | |
a.Body = EncodingUtil.base64Decode(base64Data); |
This file contains 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 AutocompleteController { | |
@AuraEnabled | |
public static List<sObject> getSuggestions(String sObjectType, String term, String fieldsToGet, Integer limitSize) { | |
// could add in logic to remove possible duplicate fields | |
String fields = fieldsToGet.length() > 0 ? ',' + fieldsToGet : ''; | |
String soql = | |
' SELECT Name, Id ' + String.escapeSingleQuotes(fields) + | |
' FROM ' + String.escapeSingleQuotes(sObjectType) + | |
' WHERE Name Like \'' + String.escapeSingleQuotes(term) + '%\'' + |
This file contains 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
<apex:page > | |
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/themes/smoothness/jquery-ui.css" /> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> | |
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/jquery-ui.min.js"></script> | |
<apex:remoteObjects > | |
<apex:remoteObjectModel name="Contact" fields="Name,Id,Email,MobilePhone,Phone"/> | |
</apex:remoteObjects> | |
This file contains 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 with sharing class ContactsController { | |
@RemoteAction | |
public static Map<String, Object> retrieveContacts(String type, List<String> fields, Map<String, Object> criteria) { | |
// Retrieve using the standard retrieve | |
Map<String, Object> result = RemoteObjectController.retrieve(type, fields, criteria); | |
// Add in the total record count for the current user. | |
// This is needed to know when to stop scrolling. |
This file contains 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
@RestResource(urlMapping='/v1.0/messages') | |
global class MessageService { | |
@HttpGet | |
global static void getMessages() { | |
// buildMessages gets FeedItems | |
List<Message> messages = buildMessages(); | |
RestResponse res = RestContext.response; |
NewerOlder