2

I have been testing some features in Lightning recently, but they just don't seem to work, e.g. List view for an object, no matter what I do it never seems to do anything when I click on the button, the gotoList function is executed but does not redirect or show the list, I am testing everything in a DevConsole. Here is a sample code, for the List View, I've been trying to achieve for Account object. Can anyone please explain me why it does not work and how to fix that?

Acc.app

<aura:application implements="force:appHostable">
    <ltng:require styles="/resource/slds0121/assets/styles/salesforce-lightning-design-system.min.css"/>
    <c:Account />
</aura:application>

Account.cmp

<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>

AccountController.js

({
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);
},

})

LGTN_AccountController.cls

public with sharing class LGTN_AccountController {

   @AuraEnabled 
   public static ListView getListViews(){
       return [SELECT Id, Name FROM ListView WHERE SobjectType = 'Account' LIMIT 1].get(0);
    }
}
4

It looks to me like you are attempting to use force:navigateToList etc outside of S1/Lightning Experience? If you are using your own custom .app then your code is responsible for handling those events on the receiving end. There is currently no "default" implementation outside of S1/LEX that is listening or responding to those events. There is work underway to productize/refactor the thing in S1/LEX that does this routing (known currently as CenterStage) but that is going to be a release or 2 before it sees the light of day on the platform.

  • Thanks for the answer. I just found out myself about it. I had to create an app in Lightning Builder and add these annotations implements="force:appHostable,flexipage:availableForAllPageTypes" access="global" to my component and add it to the app. Then in Chrome enforce the mobile view e.g. iPhone 6 and login again then I was redirected to salesforce1 app and from a drawer I was able to select my component. Works like a charm. – Paul Feb 8 '16 at 14:00
  • I want to make sure I'm clear on list views in Lightning, since it's an item I have to tackle myself soon. I'm developing a standalone app (no Lightning Experience or Salesforce 1). Am I correct in my understanding that I have to custom code any and all support for list view type functionality, including if I wanted users to specify custom views, adding/removing columns, sorting, etc? There is nothing already built-in to show list views in a standalone Lightning Component? Thanks. – Florissant53 May 2 '17 at 20:30
-1

To display events as list, open the thunderbird calendar module Lightning, then at the bottom right side of the screen, select "Today Pane". On top of "Today Pane" toggle between Tasks / Tasks and Events / Events display format. The "Event" format displays all upcoming events as a list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.