I have been using the below code for a year and it worked as expected since the update I have to refresh the screen before the filter will apply and also the filter does not update on change.
Can you please help?
fd.spRendered(function() {
function filterLookup(v){
// getting the selected Choice (0 if nothing is selected).
var choice = v;
//today’s date:
var today = new Date();
//number of ms in a day:
var day = 86400000;
//amount of days:
var amountOfDays = 21;
//get date to filter with:
var filterValue = today - (day * amountOfDays);
var filterDate = new Date(filterValue);
I have another form that is behaving the same way it is as if Lookup filters are no longer functioning as well as the javascript is no longer detecting the on change function.
Most probably, the issue is the lookup fields are not ready at the moment the filtering is applied, that’s why the error “Cannot set property “filter” of undefined” appeared.
After some debugging I have discovered that the issue is fd.field(‘Race’).widget.dataSource.read(); is null, So your stating using “ready” makes sense however the documentation refers to using two look up. In my case Series is a choice and only
Race is a lookup. When I attempted to put the ready on Race it stated that ready was not a function. Could you please help clarify this.
Alex,
after getting the ready function working. We still had issues we discoved that the select statement on the look up is doing a select of “Series” which does not exist in the lookup column.
I do not need that column to exist. I realized this was coming from the extra fields area when I removed it. I changed that to pull back Title/Id but now filter does not apply unless you do a screen refresh…even if you change the series.
This form was being used so I had to resolve this issues quickly I removed the Title filter from the form for now. I will post the information on the other form which is in development shortly.
I am trying to get this to function correctly I have the below code
fd.field('Race').ready().then(function (field){
var whatIsTheFilter = field.filter;
var isThisNull = fd.field('Race').widget;
console.log("isWidgetNull " + isThisNull === null);
field.widget.dataSource.read();
});