简体   繁体   English

React-admin 更改过滤器 position

[英]React-admin change the filter position

This is the normal way of the filters in react-admin这是react-admin中过滤器的正常方式

在此处输入图像描述

but in my use case i want the filters in each column headings EX:但在我的用例中,我想要每个列标题中的过滤器 EX: 在此处输入图像描述

  • Show the filters inside each column headings.在每个列标题内显示过滤器。
  • All are text filters.都是文本过滤器。

I couldn't find anything to customize into this behavior, Glad if someone can help me out我找不到任何可以自定义这种行为的东西,很高兴有人可以帮助我

React-admin lib doesn't have such components, althougt is possible to write a custom one, probably with a custom DatagridHeader and DatagridHeaderCell on Datagrid component. React-admin lib 没有这样的组件,尽管可以编写自定义组件,可能在 Datagrid 组件上使用自定义 DatagridHeader 和 DatagridHeaderCell 。 The closer you can get with standard components is passing alwaysOn prop to Filter Inputs, with the same order of datagrid fields:使用标准组件越接近于将 alwaysOn 属性传递给过滤器输入,数据网格字段的顺序相同:

<Filter {...props}>
    <TextInput source="seller" alwaysOn/>
    <TextInput source="ticketType" alwaysOn/>
    <TextInput source="quantity" alwaysOn/>
    <TextInput source="createdAt" alwaysOn/>
</Filter>

That way filter inputs will be automically placed above the datagrid, with the same order of datagrid fields, with no need for selecting them on filter dropdown.这样过滤器输入将自动放置在数据网格上方,具有相同的数据网格字段顺序,无需在过滤器下拉列表中选择它们。 For datagrid with more fields, you will need to make filter inputs smaller, to fit them all on a single line.对于具有更多字段的数据网格,您需要使过滤器输入更小,以便将它们全部放在一行上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM