Skip to content

Install Filter

simkessy edited this page Mar 18, 2016 · 1 revision
<script type="text/javascript" src="http://collaboration-materiel.forces.mil.ca/sites/DGLEPM_Ops/QETE/SiteAssets/jquery.js"></script>

<div>
  <label for="filterInput">Search SOP: </label>
  <input name="listFilter" type="text" id="filterInput" />
<button onClick="CoreInvoke('createNewDocumentWithProgIDEx',event,'http:\u002f\u002fcollaboration-materiel.forces.mil.ca\u002fsites\u002fDGLEPM_Ops\u002fQETE\u002fdemo\u002fQETE SOPs\u002fForms\u002fStandard Operating Procedure\u002fSOP  Template.docx', 'http:\u002f\u002fcollaboration-materiel.forces.mil.ca\u002fsites\u002fDGLEPM_Ops\u002fQETE\u002fdemo\u002fQETE SOPs', 'SharePoint.OpenDocuments', true, 1)">New SOP</button>
</div>

<script type="text/javascript">
  $(document).ready(function() {
    // Table of my link list. Obviously we reference the class and not the id. 
    var list = $("table.ms-listviewtable").first();
    // Table row of the items in my list.
    var listItems = $("table.ms-listviewtable tr:not(.ms-viewheadertr)");
    // Our filter input.
    var input = $("input#filterInput");

    input.keyup(function() {
      listItems.each(function() {
        var text = $(this).text().toLowerCase();
        if (text.indexOf(input.val()) != -1) {
          $(this).show();
        } else {
          $(this).hide();
        }
      });
    });
  });
</script>
Clone this wiki locally