0

I have a list containing 13000 items. I have set up views so that none of the views exceed the 5000 item list view threshold. We need to be able to search this entire list, not just search within the specific views. I am using SharePoint Online, and I do not see any way to select "This List" as a search starting point. Is there a web part that can do this? Right now, when I am in a view and I use the "Find an item" box, it only finds items in that specific view, and does not return items that are in a different view. Thank you!

3
  • Not sure about OOTB, but can be achieved via custom webpart
    – Gaurravs
    Commented May 30, 2016 at 4:56
  • You could add path filter to your search query to restrict the results to only your list. Like {searchterm} path:{listurl}.
    – Suleyman
    Commented May 30, 2016 at 7:48
  • Rather than path you could also create a content type for the list. Then search on the Content Type. Commented May 30, 2016 at 12:24

1 Answer 1

-1

If you want to search within page than there is a simple solution.

Add one CEWP above the list & put below code in it.

<script type="text/javascript">
function getElementsByCssClass(sTagName, sClassName) {
    var results = new Array();
    var allTagElements = document.getElementsByTagName(sTagName);
    for (i = 0; i < allTagElements.length; i++) {
        if(allTagElements[i].className == sClassName) results.push(allTagElements[i]);
    }
    return results;
}

function getTxt(obj) {
    if(obj.innerText) return obj.innerText;
    else return obj.textContent;
}

var lvRows = null;

function quickSearch(term) {
    if(lvRows == null) {
        var lvTable = getElementsByCssClass("table","ms-listviewtable")[0];
        lvRows = lvTable.childNodes[0].childNodes;
    }
    for(i = 1; i < lvRows.length; i++) {
        if(getTxt(lvRows[i]).toLowerCase().indexOf(term.toLowerCase()) > -1) {
            lvRows[i].style.display = "table-row";
        }
        else lvRows[i].style.display = 'none';
    }
}
</script>
Quick Search: <input type="text" onkeyup="quickSearch(this.value)" class="ms-long"/>

It is working in SP2010 on-premises. I haven't tried it on SP Online.

But i am sure that it will work after changing the variables/classnames in above code.

LIMITATIONS

It will search the item within the current page items like if your list shows 100 items per page than it will search from that 100 items only.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.