Tech Blog

PrimoVE Item Locations Filter

We recently switched from Primo to PrimoVE and have had numerous complaints about activating the Filter Options for item locations in the Full Display view.

Here is the code I wrote to auto-enable the filter so that it will be on for users when they do a search. Here is a sample picture showing the filter on:

Here is the code:

/* Load JQuery */
/* JQuery required for this process */

var js = document.createElement('script') ;
js.src = "//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js";
document.head.appendChild(js);

(function(){
  "use strict";
  "use strict";

  var app = angular.module('viewCustom', ['angularLoad']);

  //Auto activates the filter for items in full display
  //written on 2/4/20 by Joe Ferguson from the University of Tennessee, Knoxville
  app.component('prmLocationItemsAfter', {
    bindings: {parentCtrl: '<'},
    controller: function($scope){
      var myVar = setInterval(activateFilter, 1000);

      function activateFilter() {
        if( $("span:contains('Filters')").length ){
          clearInterval(myVar);
          return;
        }

        if( $("[id^='filter']").length ){
          $("[id^='filter']").parent().click()
        }
      }
    }
  });
})();

6 Replies to “PrimoVE Item Locations Filter”

  1. I updated the code sample to show what the entire custom.js file would look like if you just had this customization. It requires the addition of jquery which I did not include in the previous code.

Leave a Reply