etisson
2 years agoAce
set default searchGranularity
Hi all,
I was looking to set the search granularity default option to search only in TKB when the knowledge base was selected.
I came up with this code and added this to a custom component. The custom component was added to the category_page.
<#-- Sets the default search for knowledge center and TKB -->
<#-- the coreNode.id will differ in your env. This is the id of nodes you wish to add this code to -->
<#if coreNode.id == "<your node id>">
<@liaAddScript>
; (function ($) {
$("#searchGranularity").val("<value you want to select>|category").change();
})(LITHIUM.jQuery);
</@liaAddScript>
</#if>
<#-- the coreNode.id will differ in your env. This is the id of the nodes you wish to add this code to -->
<#if coreNode.id == "<your node id>">
<@liaAddScript>
; (function ($) {
$("#searchGranularity").val("<value you want to select>|tkb").change();
})(LITHIUM.jQuery);
</@liaAddScript>
</#if>
Feel free to add comments and improvemetns.
If you like this, kudos are alwayse nice!