Skip to content

Commit 37e2eb7

Browse files
authored
[REL-1082418] Update picker-override-filters Example (#5)
The existing example causes the picker to error. This update provides a working example.
1 parent 3331770 commit 37e2eb7

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

examples/JsEventHandlerExamples/picker-override-filters.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,12 @@
99
for (var i = 0; i < potentialPickerFields.length; i++) {
1010
// ideally you'd target which specific field you want to override, but in this case, let's naively replace all potential picker fields
1111
potentialPickerFields[i].pickerDataSource = {
12-
customGetDataFunction: function(defaultGetDataFunction, request) {
13-
// override the filter for the request, you can set this to a value that you can get from the layout (i.e. via FieldHelper)
14-
request.filters[2].condition = {
15-
value: "Apple",
16-
displayValue: "Apple",
17-
operator: "is like"
18-
};
19-
20-
return defaultGetDataFunction(request);
21-
}
12+
customGetDataFunction: (defaultGetDataFunction, request) =>
13+
defaultGetDataFunction(request).then(data => ({
14+
...data,
15+
// filter the results to include only items where the 'Name' column has a value of 'apple'.
16+
Results: data.Results.filter(item => item["Name"] === "apple")
17+
}))
2218
}
2319
}
2420
}

0 commit comments

Comments
 (0)