I have this lightning component that successfully gets knowledge articles from KnowledgeArticleVersion and I have verified the correct data coming through dev console logs... However, I am having some trouble using aura atrributes. I am unable to get the component to actually render the data. I am guessing my issue has something to do with trying to return list data to SObject[] type, thus not allowing {!article.Id} etc to render any data in the component.
Any ideas?
.cmp
<aura:component implements="forceCommunity:availableForAllPageTypes" controller="GetHBArticles">
<aura:attribute name="articles" type="SObject[]"/>
<ui:button label="Get Articles" press="{!c.getArts}"/>
<aura:iteration var="articles" items="{!v.articles}">
<p>{!articles.Id} : {!articles.Title} : {!articles.ArticleType}</p>
</aura:iteration>
</aura:component>
lightning controller
({
getArts: function(cmp){
var action = cmp.get("c.getArticlesList");
action.setCallback(this, function(response){
var state = response.getState();
if (state === "SUCCESS") {
cmp.set("v.articles", response.getReturnValue());
}
});
$A.enqueueAction(action);
}
})
apex controller
public with sharing class GetHBArticles {
@AuraEnabled
public static List<List<SObject>> getArticlesList(){
List<List<SObject>> articles = [FIND :searchVar RETURNING KnowledgeArticleVersion
(Id, Title, ArticleType WHERE PublishStatus='online' AND Language = 'en_US' AND ArticleType IN ('Troubleshooting__kav', 'How_To__kav', 'FAQ__kav'))
WITH DATA CATEGORY Topics__c AT 'DataCategoryName];
return articles;
}
}
As always any help from this awesome group is greatly appreciated.