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
rdclk23rdclk23 

knowledge:articleList with custom controller

I've built the knowledge article pagenation example with a custom controller from the Salesforce Knowledge Developers Guide (page 14).  I can't figure our how the <knowledge:articleList> tag knows to read the List<KnowledgeArticleVersion> created in the custom controller constructor from SOQL.  I don't see a parameter on the  <knowledge:articleList> and the List in the controller does not have a property or method to expose it.
Alex SelwynAlex Selwyn
The example would list all the knowledge article in your org. The controller in the example is only to support the 'Pagination'.

<knowledge:articleList> uses a attribute 'keyword' to search the articles. its a prebuilt component and does not need a list to be fed from the controller.

You need to bind the 'keyword' in the component and the controller's soql query( to support the pagination for a keyword search).

Hope that helps.
rdclk23rdclk23
So if we want to limit the records by category or keyword, we need to use it as an attribute on the ArticleList in the VF page AND as argument on the SOQL in the Controller so the record counts match.  The list in the Controller is not displayed on the VF page, just used for counting pages and controlling the prev next link visibility. The ArticleList tag in the VF page does it's own query and the Controller makes the ArticleList scroll back or forward by adjusting the pageNumber attribute on the ArticleList.  If the user changes a filter criteria we would have to reload the page.  Too bad there is no easy way to bring the ArticleList 'hasMoreVar' value into the controller.  I think that would eliminate the need for the hidden SOQL List.
Alex SelwynAlex Selwyn
Unfortunately yes!. You can try SOSL in the controller instead of ArticleList component. Use the keyword in the SOSL and bring the list of articles to the page and use pageblock table. This way you will have more control on the pagination.

ArticleList provides default keyword searched report, you can use SOSL's 'WITH TRACKING' to track the keywords searched.