Page 1 of 2
Filtering related items error
Posted: 19 Sep 2018
by Katy
Hi ,
I am trying to do the filtering using
this article and i am getting this error:
- filterissue.jpg (28.81 KiB) Viewed 1611 times
How can i fix that?
Re: Filtering related items error
Posted: 20 Sep 2018
by AlexZver
Hi, Katy
What type of the field do you use as filtering field? Could you please provide the screenshot of your form with related items settings and your filtering code?
Re: Filtering related items error
Posted: 20 Sep 2018
by Katy
Hi Alex,
I believe the problem is that these two lists are not exactly related by look up, here is the situation:
Main list A (form) has a drop-down column with departments and the support list B has the same column with departments (it is text now but i can turn is to choice with drop-down). I need to have information from the list B to be shown for reference purpose only when they choose a department in list A - show only those lines from list B which are appropriate. Does it make sense? Should it work?
Correction: these lists are actually connected but main list A has a look -up to list B to get all the roles...
Re: Filtering related items error
Posted: 21 Sep 2018
by AlexZver
Hi Katy,
This should work proceeding from your description. To be more helpful I should have more details about your issue, so could you provide some more information? The screenshot of your form and the code would be relevant.
Re: Filtering related items error
Posted: 21 Sep 2018
by Katy
Sure.
This is the main form with related item:
- filterissue1.jpg (201.93 KiB) Viewed 1592 times
I also tried to show All items without filter in the data source...
And here is the code:
setHash();
fd.field('IFSDepartments').change(setHash);
function setHash(){
var value = encodeURIComponent(escape(fd.field('IFSDepartments').value())).replace(/\-/g, "%252D");
window.location.hash = "InplviewHash" + $(".related-roles [webpartid]").attr("webpartid") + '=FilterField=Department-FilterValue=' + value;
}
Re: Filtering related items error
Posted: 24 Sep 2018
by AlexZver
Hi Katy,
The error is quite usual, I can't yet understand the reasons. Please try it on a different list, create new fresh lists to test the filtering itself with no extra fields or scripts. It helps us to figure out where the problem comes from.
Please, use either JS hash filtering or data source, not both. If you need dynamic filtering, please, stick to JS only.
Data source filtering does not update dynamically with values on the form, it only runs once when the form is opened.
Re: Filtering related items error
Posted: 24 Sep 2018
by Katy
Re: Filtering related items error
Posted: 24 Sep 2018
by AlexZver
What about a brand new related items list? Is it the same behavior?
Please, try not to use both JavaScript and Data Source: Filter by form field.
Data Source: Filter by form field will only filter the results when you open the form, but won't work dynamically as you change IFSDepartments field, so it's best to leave it as Show all items from the view. This might be related to the error, so, please, change this setting.
Re: Filtering related items error
Posted: 24 Sep 2018
by Katy
I did a new reference list - same error.
I also switched to All items view in Data source - the same error, i've tested that before on my original list - didn't work
Re: Filtering related items error
Posted: 24 Sep 2018
by Nikita Kurguzov
Dear Katy,
If this is the case, please, remove the script entirely. Try to go to the form, click the small arrow near the Department column (appears when you move the cursor over it), and select any value for filtering:
- Filters.png (7.8 KiB) Viewed 1569 times
What this essentially does is the same as the script. If you get the same error, please, try to do this outside the form, on the list itself.
Send us screenshots of the filtered list if this actually works in either the form, or the list itself.