Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. <aura:application implements="force:appHostable">
  2. <ltng:require styles="/resource/slds0121/assets/styles/salesforce-lightning-design-system.min.css"/>
  3. <c:Account />
  4. </aura:application>
  5.  
  6. <aura:component controller="LGTN_AccountController">
  7. <ltng:require styles="/resource/slds0121/assets/styles/salesforce-lightning-design-system.min.css"/>
  8. <aura:dependency resource="markup://force:navigateToList" type="EVENT"/>
  9. <aura:dependency resource="markup://force:navigateToSObject" type="EVENT"/>
  10. <ui:button label="List View" press="{!c.gotoList}"/>
  11. </aura:component>
  12.  
  13. ({
  14. gotoList : function (component, event, helper) {
  15. var action = component.get("c.getListViews");
  16. action.setCallback(this, function(response){
  17. var state = response.getState();
  18. console.log('clicked');
  19. if (state === "SUCCESS") {
  20. var listviews = response.getReturnValue();
  21. var navEvent = $A.get("e.force:navigateToList");
  22. navEvent.setParams({
  23. "listViewId": listviews.Id,
  24. "listViewName": null,
  25. "scope": "Account"
  26. });
  27. navEvent.fire();
  28. }
  29. });
  30. $A.enqueueAction(action);
  31. },
  32.  
  33. public with sharing class LGTN_AccountController {
  34.  
  35. @AuraEnabled
  36. public static ListView getListViews(){
  37. return [SELECT Id, Name FROM ListView WHERE SobjectType = 'Account' LIMIT 1].get(0);
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement