Skip to content

Instantly share code, notes, and snippets.

@JitendraZaa
Created August 29, 2017 19:35
Show Gist options
  • Select an option

  • Save JitendraZaa/459dea89a93d1c17c67fb73d8395695f to your computer and use it in GitHub Desktop.

Select an option

Save JitendraZaa/459dea89a93d1c17c67fb73d8395695f to your computer and use it in GitHub Desktop.
Use Visualforce in Classic and Lightning Experience - http://www.jitendrazaa.com/blog
<apex:page standardController="Contact" recordSetVar="contacts" standardStylesheets="false" applyBodyTag="false">
<apex:variable var="lightningDesktop" value="{! $User.UIThemeDisplayed == 'Theme4d'}" />
<div class="slds-scope">
<apex:outputPanel rendered="{! !lightningDesktop}">
<link class="user" href="/sCSS/38.0/sprites/1245343872000/Theme3/default/elements.css" rel="stylesheet" type="text/css" />
<link href="/sCSS/38.0/sprites/1251310209000/Theme3/dStandard.css" rel="stylesheet" type="text/css" />
<apex:form >
<apex:pageBlock title="Contacts List" id="contacts_list">
<apex:outputLabel value="Filter: " for="filterList" />
<apex:selectList value="{! filterId }" size="1" id="filterList">
<apex:selectOptions value="{! listViewOptions }"/>
<apex:actionSupport event="onchange" reRender="contacts_list" oncomplete="init();"/>
</apex:selectList>
<!-- Contacts List -->
<apex:pageBlockTable value="{! contacts }" var="ct">
<apex:column value="{! ct.FirstName }"/>
<apex:column value="{! ct.LastName }"/>
<apex:column value="{! ct.Email }"/>
<apex:column value="{! ct.Account.Name }"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:outputPanel>
<apex:outputPanel rendered="{! lightningDesktop}">
<apex:slds />
<apex:form >
<apex:pageBlock id="contacts_list">
<div class="slds-card">
<div class="slds-card__header">
<h2 class="slds-text-heading--small">
Contacts List
</h2>
</div>
<div class="slds-form slds-m-left--large slds-m-bottom--small slds-size--1-of-6">
<apex:outputLabel value="Filter: " for="filterList" styleClass="slds-form-element__label" />
<div class="slds-select_container">
<apex:selectList value="{! filterId }" size="1" id="filterList" styleClass="slds-select">
<apex:selectOptions value="{! listViewOptions }"/>
<apex:actionSupport event="onchange" reRender="contacts_list"/>
</apex:selectList>
</div>
</div>
<!-- Contacts List -->
<table class="slds-table slds-table--bordered slds-table--cell-buffer">
<thead>
<tr class="slds-text-title--caps">
<th scope="col">
<div class="slds-truncate" title="First Name">First Name</div>
</th>
<th scope="col">
<div class="slds-truncate" title="Last Name">Last Name</div>
</th>
<th scope="col">
<div class="slds-truncate" title="Email">Email</div>
</th>
<th scope="col">
<div class="slds-truncate" title="Account Name">Account Name</div>
</th>
</tr>
</thead>
<tbody>
<apex:repeat value="{! contacts }" var="ct">
<tr>
<th scope="row" data-label="First Name">
<div class="slds-truncate" title="{! ct.FirstName }">{! ct.FirstName }</div>
</th>
<td data-label="Last Name">
<div class="slds-truncate" title="{! ct.LastName }">{! ct.LastName }</div>
</td>
<td data-label="Email">
<div class="slds-truncate" title="{! ct.Email }">{! ct.Email }</div>
</td>
<td data-label="Account">
<div class="slds-truncate" title="{! ct.Account.Name }">{! ct.Account.Name }</div>
</td>
</tr>
</apex:repeat>
</tbody>
</table>
</div>
</apex:pageBlock>
</apex:form>
</apex:outputPanel>
</div>
</apex:page>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment