简体   繁体   English

“材料表”-有没有办法从表中分离过滤。 -ReactJs

[英]“material-table” - Is there a way to seperate filtering from the table . - ReactJs

Hey guys i don't know if this is possible , but i would like to have the filtering with the dropdown on a seperate component outside of the table , but still to filter the current table . 嗨,我不知道这是否可行,但我想在表之外的一个单独组件上进行下拉过滤,但仍要过滤当前表。 Is this thing possible ? 这可能吗? And if it is can i have an example ? 如果可以的话,我可以举个例子吗? 在此处输入图片说明

You can change the data prop of the material-table. 您可以更改物料表的data属性。 See this simple example where an separate button component changes the sorting of the content. 请参见这个简单的示例 ,其中一个单独的按钮组件更改了内容的排序。

  1. Store the data in the wrapping components state. 将数据存储在包装组件状态中。
  2. Render the filter and the material-table component. 渲染过滤器和物料台组件。
  3. Change the state (data) when the filter changes (you will have to implement the filter logic). 过滤器更改时更改状态(数据)(您将必须实现过滤器逻辑)。

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

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