Hi everyone,
I am working on a Creatio Freedom UI page (8.3.x) where I have a DataGrid displaying records related to the current record. I need to provide users with a custom filter button that applies an additional filter to the grid programmatically.
Requirement
I have a lookup field, let's call it "Category", on the records displayed in the grid.
The requirement is:
- The grid already has the standard Freedom UI filters / Quick Filters.
- I want to add a custom button outside the grid.
- When the user clicks the button, I want to apply a specific Category value to the grid.
- The value may come dynamically from another field/page parameter, although for testing I am currently using a hardcoded GUID.
- The custom filter should work together with the existing grid filters, rather than replacing them.
- The grid should refresh automatically after applying the filter.
I created a custom request handler for the button:
{
request: "ApplyGridFiltersRequest",
handler: async (request, next) => {
const categoryId =
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
console.log("Category:", categoryId);
await request.$context.executeRequest({
type: "crt.LoadDataRequest",
$context: request.$context,
dataSourceName: "MyGridDataSource"
});
return await next?.handle(request);
}
}
This successfully triggers the grid reload.
I can also confirm that the crt.LoadDataRequest is being triggered and that the custom value is available.
However, I haven't found the correct way to inject the filter into the grid's existing filter collection.
- Apply a filter programmatically to a specific DataGrid datasource?
- Preserve the filters already applied by the user?
- Add my custom filter as an additional condition?
- Trigger the grid reload after applying it?
- Ideally remove/change the custom filter later without affecting the user's other filters?
Is there a supported request/API for manipulating the DataGrid's filter collection, or is the recommended approach to use a ViewModel attribute/page parameter bound to the grid filter?
I would prefer a supported Freedom UI approach rather than directly manipulating the DOM or relying on internal/private APIs.
Any examples using crt.*Request handlers would be greatly appreciated.
Thanks!