vLookup Search

Forums vLooup for SharePoint vLookup Search

Viewing 1 reply thread
  • Author
    Posts
    • #23611
      Wilson
      Participant

      Hi Alex,
      Would it be possible add search ability to vlookup? Something similar to the default search box on a list view would be convenient when you have a large number of child items.

      Thanks again for all you do!
      Bob

    • #23618
      Alexander Bautz
      Keymaster

      You can add it with some Custom JS. This example highlights the matched items.

      Add this to your Custom JS

      function highlightMatches(elm, fin) {
          var sVal = jQuery(elm).val(), container = jQuery("#vLookup_" + fin + "_" + spjs.dffs.data.thisItemID).find(".vLookupTable");
          jQuery(".highlightSearchMatchInvLookup").removeClass("highlightSearchMatchInvLookup");
          if (sVal !== "") {
              container.find("tr").each(function (i, tr) {
                  if (jQuery(tr).text().match(sVal) !== null) {
                      jQuery(tr).addClass("highlightSearchMatchInvLookup");
                  }
              });
          }
      }

      Then add this to the Custom CSS

      .highlightSearchMatchInvLookup{
          background-color:yellow;
      }

      Then add this to a HTML section above the vLookup field
      Change “vLookupTasks” to match your vLookup field name:

      <div style="margin-top:3px;">Search for matching items: <input type="text" id="vLookupSearchField" onkeyup="highlightMatches(this,'vLookupTasks')" /></div>

      Let me know how it works out.

      Alexander

Viewing 1 reply thread
  • You must be logged in to reply to this topic.