I have a list named childribbon and in the new form of this list I have added the same list which is being displayed in display form, enter image description here

If I set the Employee to Nderon Hiseni in my childribbon new fort

I want only items with Nderon Hiseni to be displayed in my childribbon display form?

How Can I do this with javascript?

  • Use sharepoint rest api or jsom to get the filtered items. – Tarek Salah uddin Mahmud Aug 18 '16 at 13:07
  • How Can I make this? – Nderon Hyseni Aug 18 '16 at 13:09
  • Can you explain me because I am new to sharepoint! – Nderon Hyseni Aug 18 '16 at 13:09
  • Does Employee field show the title from the lookup field? – Tarek Salah uddin Mahmud Aug 18 '16 at 13:11
  • No Employee field is looked up by another list column – Nderon Hyseni Aug 18 '16 at 13:12

If this is one webpage then you can

  • Add an onchange eventhandler on the drop down <select>
  • Then use a JS standard document.querySelector to find the matching elements in the list
  • You then loop all elements, find the parent TR row, and hide

Something like: disclaimer: didn't not test this code, you are on your own

document.getElementById('mySelect').addEventListener('onchange', function () {
    var employeeName = this.value;
    var matches = document.querySelector("a[href*=" + employeeName + "']");
    matches.forEach(function (match) {
        var row = GetAncestor(match, 'TR');
  • GetAncestor is provided by SharePoint
  • You have to add ...display='block' yourself to show rows again
  • forEach might need a Polyfill in older IE versions

Sharepoint rest api example if Employee is a lookup field and it displays the Title

var url= "/_api/Web/Lists/GetByTitle('childribbon')/Items?"+
           "&$expand=Employee&$filter=Employee/Title eq 'Nderon Hiseni'";
    url: _spPageContextInfo.webAbsoluteUrl + url,
    type: "GET",
    headers: {
        "accept": "application/json;odata=verbose",
    success: function (data) {
    error: function (error) {

Otherwise, if Employee is not a lookup field then the url should be

var url= "/_api/Web/Lists/GetByTitle('childribbon')/Items?"+
           "&$filter=Employee eq 'Nderon Hiseni'";

You can read this article for better understanding http://www.codeproject.com/Articles/990131/CRUD-Operation-to-List-Using-SharePoint-Rest-API

  • I want it to be dynamically not static, I have set a cookie with can I use that cookie to display user? – Nderon Hyseni Aug 18 '16 at 13:21
  • 1
    write a function and pass a variable which contains the employee name. Then call ajax with the variable – Tarek Salah uddin Mahmud Aug 18 '16 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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