You need to sign in to do that
Don't have an account?
Jonathan Wolff 7
Custom Chatter Component does not appear in "Edit page"
Hello, I want to use a component I found on the internet. I added it in my developer console but it doesn't show up on my "Edit page" side. Could you give me some help?
The code:
<aura:component implements="force:appHostable">
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<aura:attribute name="options" type="List" />
<aura:attribute name="type" type="String" default="News" description="The type of feed" access="GLOBAL"/>
<aura:attribute name="types" type="String[]"
default="Bookmarks,Company,DirectMessages,Feeds,Files,Filter,Groups,Home,Moderation,Mute,News,PendingReview,Record,Streams,To,Topics,UserProfile"
description="A list of feed types"/>
<h1>My Feeds</h1>
<lightning:select aura:id="typeSelect" onchange="{!c.onChangeType}" label="Type" name="typeSelect">
<aura:iteration items="{!v.options}" var="item">
<option text="{!item.label}" value="{!item.value}" selected="{!item.selected}"/>
</aura:iteration>
</lightning:select>
<div aura:id="feedContainer" class="feed-container">
<forceChatter:feed />
</div>
</aura:component>
({
// Handle component initialization
doInit : function(component, event, helper) {
var type = component.get("v.type");
var types = component.get("v.types");
var opts = new Array();
// Set the feed types on the lightning:select component
for (var i = 0; i < types.length; i++) {
opts.push({label: types[i], value: types[i], selected: types[i] === type});
}
component.set("v.options", opts);
},
onChangeType : function(component, event, helper) {
var typeSelect = component.find("typeSelect");
var type = typeSelect.get("v.value");
component.set("v.type", type);
// Dynamically create the feed with the specified type
$A.createComponent("forceChatter:feed", {"type": type}, function(feed) {
var feedContainer = component.find("feedContainer");
feedContainer.set("v.body", feed);
});
}
})
The code:
<aura:component implements="force:appHostable">
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<aura:attribute name="options" type="List" />
<aura:attribute name="type" type="String" default="News" description="The type of feed" access="GLOBAL"/>
<aura:attribute name="types" type="String[]"
default="Bookmarks,Company,DirectMessages,Feeds,Files,Filter,Groups,Home,Moderation,Mute,News,PendingReview,Record,Streams,To,Topics,UserProfile"
description="A list of feed types"/>
<h1>My Feeds</h1>
<lightning:select aura:id="typeSelect" onchange="{!c.onChangeType}" label="Type" name="typeSelect">
<aura:iteration items="{!v.options}" var="item">
<option text="{!item.label}" value="{!item.value}" selected="{!item.selected}"/>
</aura:iteration>
</lightning:select>
<div aura:id="feedContainer" class="feed-container">
<forceChatter:feed />
</div>
</aura:component>
({
// Handle component initialization
doInit : function(component, event, helper) {
var type = component.get("v.type");
var types = component.get("v.types");
var opts = new Array();
// Set the feed types on the lightning:select component
for (var i = 0; i < types.length; i++) {
opts.push({label: types[i], value: types[i], selected: types[i] === type});
}
component.set("v.options", opts);
},
onChangeType : function(component, event, helper) {
var typeSelect = component.find("typeSelect");
var type = typeSelect.get("v.value");
component.set("v.type", type);
// Dynamically create the feed with the specified type
$A.createComponent("forceChatter:feed", {"type": type}, function(feed) {
var feedContainer = component.find("feedContainer");
feedContainer.set("v.body", feed);
});
}
})
Hello, Jonathan.
You only added force:appHostable,
but you also need to add flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,
force:hasRecordId,force:lightningQuickAction and also add
access="global" in aura component.
Then you can see your aura component name on the edit page.
If your problem is resolved give my answer as the best answer.
Thank you.