如何应用 GridColumn -> GridColumnMenuFilter 的初始值(Kendo React)?
How apply initial value of GridColumn -> GridColumnMenuFilter (Kendo React)?
我需要在 GridColumnMenuFilter 中设置初始过滤器值。
问题:初始值适用于标题下的过滤器,但不适用于 GridColumnMenuFilter 内部的过滤器。
filter under the title with initial value
filter inside GridColumnMenuFilter without initial value
代码示例:
const initialFilter: CompositeFilterDescriptor = {
logic: "and",
filters: [
{
field: "isAdmin",
operator: "eq",
value: true,
},
],
};
const GridColumnMenu = (props: GridColumnMenuProps): JSX.Element => {
return (
<div>
<GridColumnMenuFilter {...props} expanded={true} hideSecondFilter />
</div>
);
};
const columnProps = (
field: string
) => {
return {
field: field,
columnMenu: GridColumnMenu
};
};
<Grid
data={tableData.data}
filterable={true}
filter={initialFilter}
>
<GridColumn
title={"Is Admin>"}
{...columnProps("isAdmin")} />
...
</Grid>
感谢您的帮助。
初始过滤器值必须是这样的:
const initialFilter: CompositeFilterDescriptor = {
filters: [
{
logic: "and",
filters: [
{
field: "isAdmin",
operator: "eq",
value: true,
},
],
},
],
logic: "and",
};
然后过滤器将在 GridColumnMenuFilter.
中正常工作
我需要在 GridColumnMenuFilter 中设置初始过滤器值。
问题:初始值适用于标题下的过滤器,但不适用于 GridColumnMenuFilter 内部的过滤器。
filter under the title with initial value
filter inside GridColumnMenuFilter without initial value
代码示例:
const initialFilter: CompositeFilterDescriptor = {
logic: "and",
filters: [
{
field: "isAdmin",
operator: "eq",
value: true,
},
],
};
const GridColumnMenu = (props: GridColumnMenuProps): JSX.Element => {
return (
<div>
<GridColumnMenuFilter {...props} expanded={true} hideSecondFilter />
</div>
);
};
const columnProps = (
field: string
) => {
return {
field: field,
columnMenu: GridColumnMenu
};
};
<Grid
data={tableData.data}
filterable={true}
filter={initialFilter}
>
<GridColumn
title={"Is Admin>"}
{...columnProps("isAdmin")} />
...
</Grid>
感谢您的帮助。
初始过滤器值必须是这样的:
const initialFilter: CompositeFilterDescriptor = {
filters: [
{
logic: "and",
filters: [
{
field: "isAdmin",
operator: "eq",
value: true,
},
],
},
],
logic: "and",
};
然后过滤器将在 GridColumnMenuFilter.
中正常工作