I'd like to filter SharEPoint list using values from another list via JS Link. I know how to filter using for example list of ID's. I found nice article for that but now I need firstly to connect to another list then find relevant item and take value from relevant column to use it as a filter. For filtering I use the following function:

(function () {

var excludeRows = [0,2,3];

function renderListItemTemplate(renderCtx) {
    if(excludeRows.indexOf(renderCtx.CurrentItemIdx) > -1)
       return ''; //do not render row
    return RenderItemTemplate(renderCtx); 

function registerListRenderer()
   var context = {};
   context.Templates = {};
   context.Templates.Item = renderListItemTemplate;

ExecuteOrDelayUntilScriptLoaded(registerListRenderer, 'clienttemplates.js');

As I mentioned it works for me. Now I'd like to retrieve some data from another list to filter this list. I try to use SP.ClientContext() ... firstly but it doesn't work for me. I suppose problem with code structure or maybe I have to load any library before. I have no idea how to do it correctly. Maybe another idea would be useful?

I thought about calculated columns but I don't think so it would be useful for me. Ok maybe I will explain my idea more deeply. I'm developing complex solution (not based only on the SharePoint) where displaying relevant items from the list is only small part of the system. Let's imagine we have two lists: Workers and Resources. In the Workers list I have column which contains IDs of the Resources. For example:

Workers List:

Username -> IDs

John -> 1,4,7,9

Bill -> 2,7.8

Resoures List:

ID -> Name

1 -> Aplication X

2 -> Aplication Y


and now I'd like to create a page where user would be able to see resources where has access to. My idea is to filter Resources List and show only relevant resources. First of all I have to recognize the user (I suppose it is not difficult) next find user in the workers List, take data from IDs column and use it to filter Resources List. I know how to filter (see example in my main post) but I need your advise how to connect to Workers list to get IDs. I decide to use JS Link but maybe there is another better solution I hope it is clear right now.

1 Answer 1


Does have to be a JS-link? or could you do something simpler?

You could use calculated columns to achieve this. For example:

you want to only display announcements where the status of a list item equals in progress.

With calculated columns you can do that. whereas you cannot get the lookup of a choice column.

Calculated Column functions and equations:
SharePoint 2013 - Calculated Column Formulas & Functions

  1. simply convert the value to text in source list Choice column
  2. then do a lookup and add the column to your announcements list.
  3. Then create filtered view with lookup column equal to in progress.

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.