dojo / dojo/widgets

[Grid] Enable use of default FilterRenderer, when appling custom filterRenderer

Open
#662 0 comments 0 reactions 0 assignees View on GitHub
low priority
Dominant language
TypeScript
Stars
92
Forks
63
PR merge metrics
No merged PRs in 30d

Description

** Enhancement**

When I apply a filterRenderer as customRenderer for the Grid I currently have to define a custom filterRenderer for all columns.
What I'd like to have is the opportunity to return the default filter renderer for certain columns by either simply returning _null_ or a different object, which let's dojo know that it has to render the default filter.

Package Version: Dojo 5

**Code**
```ts
// createDefaultFilterRenderer does not exist yet
import { createDefaultFilterRenderer } from "@dojo/widgets/grid/utils";

const customRenderers = {
filterRenderer: (
columnConfig: ColumnConfig,
filterValue: string,
doFilter: Function,
title?: string
) => {
if (columnConfig.id == "gender") {
return v("div", {}, [w(Button, {}, ["Female"]), w(Button, {}, ["Male"])]);
}
// Make use of the default filter by returning null
return null;
// ... or call an imported dojo method to render the default filter
return createDefaultFilterRenderer();
}
};
```

**Expected behavior:**

Having the opportunity to make use of the default filter renderer

**Actual behavior:**

I do not have the opportunity to tell dojo that it should use the default filter renderer

Contributor guide

Open the contributing guide

Research direction

Start at the Grid implementation and trace how the custom filterRenderer is invoked for each column, then inspect the existing default filter-rendering path. Verify whether returning null or another documented value can select the default renderer, and add tests covering custom and default filters across columns.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.