Skip to content

Instantly share code, notes, and snippets.

Avatar

Keir Bowden keirbowden

View GitHub Profile
@keirbowden
keirbowden / TableSortingCtrl.cls
Last active Aug 29, 2015
Custom controller for the table sorting blog post
View TableSortingCtrl.cls
public with sharing class TableSortingCtrl {
public List<Account> accounts {get; set;}
public TableSortingCtrl()
{
accounts=[select id, CreatedDate, Name, BillingStreet,
BillingState, BillingCity,
BillingPostalCode, BillingCountry
from Account
where BillingPostalCode!=null
@keirbowden
keirbowden / TableSorter.page
Created Sep 20, 2014
Demo page for Visualforce and tablesorter
View TableSorter.page
<apex:page sidebar="true" controller="TableSortingCtrl">
<apex:includeScript
value="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" />
<apex:includeScript
value="//cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.17.8/js/jquery.tablesorter.min.js" />
<apex:stylesheet
value="//cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.17.8/css/theme.blue.css" />
<apex:datatable value="{!accounts}" var="acc" id="accsTable" styleclass="tablesorter">
<apex:column headerValue="Created">
@keirbowden
keirbowden / RequiredCtrl.cls
Created Sep 27, 2014
Action Region, Required Fields and HTML5 Controller
View RequiredCtrl.cls
public with sharing class RequiredCtrl
{
public List<Row> rows {get; set;}
public String name {get; set;}
public Account acc {get; set;}
public RequiredCtrl()
{
rows=new List<Row>();
rows.add(new Row());
@keirbowden
keirbowden / RequiredHTML5.page
Created Sep 27, 2014
Action Region, Required Field and HTML5 Page
View RequiredHTML5.page
<apex:page controller="RequiredCtrl" tabstyle="Account" doctype="html-5.0">
<apex:pageMessages id="msgs"/>
<apex:form>
<apex:pageBlock mode="maindetail">
<apex:pageBlockButtons location="top">
<apex:commandButton value="Save" action="{!save}" />
</apex:pageBlockButtons>
<apex:pageBlockSection title="Account Information">
<apex:pageBlockSectionItem>
<apex:outputlabel value="Name"/>
@keirbowden
keirbowden / gist:a1e624fbc596f0b71ea4
Created Apr 18, 2015
Accounts List Lightning Component
View gist:a1e624fbc596f0b71ea4
<aura:component controller="AccountsListController" implements="flexipage:availableForAllPageTypes">
<link href="/resource/Bootstrap_3_3_2/bootstrap-3.3.2-dist/css/bootstrap.min.css" rel="stylesheet" />
<link class="user" href="/resource/Bootstrap_3_3_2/bootstrap-3.3.2-dist/css/bootstrap-theme.min.css"
rel="stylesheet" type="text/css" />
<aura:attribute name="accounts" type="Account[]" />
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<div class="container-fluid">
<div class="row-fluid">
@keirbowden
keirbowden / gist:c99015c1006f7a14f08d
Created Apr 18, 2015
Accounts List JavaScript Component
View gist:c99015c1006f7a14f08d
<apex:component >
<script>
var accsListCtrl={
// renders the HTML to display the supplied accounts in bootstrap panels
renderAccs : function(accounts) {
var markup='';
$.each(accounts, function(idx, acc) {
markup+= ' <div class="row-fluid"> \n' +
' <div class="col-xs-12 fullwidth"> \n' +
' <div class="panel panel-primary"> \n' +
@keirbowden
keirbowden / RWDCaseAppController.js
Last active Aug 29, 2015
JavaScript Controller for the RWDCases Lightning App
View RWDCaseAppController.js
({
doInit : function(component, event, helper) {
helper.getCases(component);
}
})
@keirbowden
keirbowden / RWDCaseAppHelper.js
Last active Aug 29, 2015
JavaScript Helper for the Lightning App to Render Cases
View RWDCaseAppHelper.js
({
getCases : function(component) {
var action = component.get("c.GetRecentCases");
var self = this;
action.setCallback(this, function(a) {
try
{
var cases=a.getReturnValue();
console.log('Result = ' + JSON.stringify(cases));
component.set("v.cases", cases);
@keirbowden
keirbowden / CasesController.cls
Created May 3, 2015
Apex Controller for the Case Render App
View CasesController.cls
public class CasesController {
@AuraEnabled
public static List<Case> GetRecentCases()
{
List<Case> cases=[select id, CaseNumber, Subject, CreatedDate, Status, Priority
from Case
order by CreatedDate desc
limit 5];
return cases;
}
@keirbowden
keirbowden / RWDCaseApp.app
Last active Aug 29, 2015
Lightning Application to Retrieve Cases and Iterate
View RWDCaseApp.app
<aura:application controller="CasesController">
<aura:attribute type="Case[]" name="cases" description="casesToIterate" />
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<aura:iteration items="{!v.cases}" var="case">
<c:RWDCase case="{!case}" />
</aura:iteration>
</aura:application>
You can’t perform that action at this time.