Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <aura:application implements="force:appHostable">
- <ltng:require styles="/resource/slds0121/assets/styles/salesforce-lightning-design-system.min.css"/>
- <c:Account />
- </aura:application>
- <aura:component controller="LGTN_AccountController">
- <ltng:require styles="/resource/slds0121/assets/styles/salesforce-lightning-design-system.min.css"/>
- <aura:dependency resource="markup://force:navigateToList" type="EVENT"/>
- <aura:dependency resource="markup://force:navigateToSObject" type="EVENT"/>
- <ui:button label="List View" press="{!c.gotoList}"/>
- </aura:component>
- ({
- gotoList : function (component, event, helper) {
- var action = component.get("c.getListViews");
- action.setCallback(this, function(response){
- var state = response.getState();
- console.log('clicked');
- if (state === "SUCCESS") {
- var listviews = response.getReturnValue();
- var navEvent = $A.get("e.force:navigateToList");
- navEvent.setParams({
- "listViewId": listviews.Id,
- "listViewName": null,
- "scope": "Account"
- });
- navEvent.fire();
- }
- });
- $A.enqueueAction(action);
- },
- public with sharing class LGTN_AccountController {
- @AuraEnabled
- public static ListView getListViews(){
- return [SELECT Id, Name FROM ListView WHERE SobjectType = 'Account' LIMIT 1].get(0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement