function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sonia singh 14sonia singh 14 

Knowledge:article tag sortBy mostViewed is not working in visualforce Component.


<apex:component allowDML="true">
<apex:attribute name="pkbCon" type="pkb_Controller" required="true" description="handle to the pkb controller" />
<apex:attribute name="HomeCatgryName" type="string" required="false" description="category name from home page" />
<apex:variable var="category" value="{!pkbCon.selectedCategory}" />
<!-- POPULAR PAGE SIZE: {!pkbCon.popularArticles}<br/> RESULTS PAGE SIZE: {!pkbCon.articlesPerPage}<br/> CURRENT PAGE: {!pkbCon.currPage}<br/> LANG: {!pkbCon.selectedLanguage}<br/> CATEGORY USED: {!category}<br/> categories={!category}.. /summary={!a.summary} / articleTypeName={!a.articleTypeName} / articleTypeLabel={!a.articleTypeLabel} / -->
<!-- 15June,2015 --> <apex:variable var="categoryTyp" value="{!IF(HomeCatgryName == 'consumerBtnLink', 'Topics:All', 'Military:All')}"/>
<apex:variable var="categoryTyp" value="{!IF(HomeCatgryName == 'militryBtnLink', 'Military:All', 'Topics:All')}"/> <!-- categories="{!category}" -->
<div> <!--<h2 class="section">{!$Label.PKB2_Popular_Articles}</h2>--> <knowledge:articleList articleVar="a" language="{!pkbCon.selectedLanguage}"
sortBy="mostViewed" pageSize="{!pkbCon.popularArticles}"
categories="{!categoryTyp}" pageNumber="1">
<c:pkb_article pkbCon="{!pkbCon}"
aid="{!a.id}"
title="{!a.title}"
summary="{!a.summary}"
urlName="{!a.urlName}"
articleTypeName="{!a.articleTypeName}"
articleTypeLabel="{!a.articleTypeLabel}"
lastModifiedDate="{!a.lastModifiedDate}"
firstPublishedDate="{!a.firstPublishedDate}"
lastPublishedDate="{!a.lastPublishedDate}"
FromHomeCatgryName="{!HomeCatgryName}" />
</knowledge:articleList>
</div>
</apex:component>
pconpcon
Just out of curiosity, does it work if you put it directly in a Visualforce page?  What does it sort by if it's not sorting by most viewed?
sonia singh 14sonia singh 14
No its is also not  working in the visualforcePage also it is displaying randomly all the articles and not getting refreshed even if we are searching the same article many times here is visualforce Page code also


<apex:page cache="false" standardStylesheets="false" showHeader="false" sidebar="false" standardController="KnowledgeArticle" extensions="pkb_Controller,DataCategoryUtil"
language="{!pkbCon.selectedLanguage}" applyBodyTag="false" applyHtmlTag="false" docType="html-5.0">


<h1 id="poular_heading01">Most Popular Articles</h1>
<span style="margin-top:0;"><c:pkb_popular pkbcon="{!pkbcon}"/></span>


</apex:page>
Jack123Jack123
Hi

i am using:

<knowledge:articleList articleVar="a" language="" sortBy="mostViewed" pageSize="" categories="" pageNumber="1">
</knowledge:articleList>

On vf page i am using <knowledge:articleList> and using this vfpage on sites, here this sortBy="mostViewed" is not working, its showing static records list, not changing as per mostviewed criteria.

Is sortBy="mostViewed" support on sites? Anyone have idea.

Please help me regarding this.