Current filter:
                                You should refresh the page.

                                1 Solution

                                Creation Date Importance Sort by

                                Hello,

                                I suggest you set the filterPanel.visible option depending on whether data is filtered or not.

                                Updated

                                We researched this case and found a better approach. You need to use onOptionChanged and track the filterPanel.filterValue option to hide/show the Filter Panel.
                                 

                                [JavaScript]
                                onOptionChanged = (e)=>{ if (e.fullName === "filterValue") { this.setState({ filterPanel: !!e.value }) } }

                                See the following example: https://codesandbox.io/s/datagrid-dynamically-showhide-filterpanel-in-react-3nlo5

                                Show all comments
                                • Customer93190 09.02.2019

                                  Hi, I tried to do that inside onContentReady

                                    const filter = e.component.getCombinedFilter();
                                      if (filter) {
                                        this.setState({filterPanel: true});
                                      } else {
                                        this.setState({filterPanel: false});
                                      }
                                  and the filter panel is visible when some filter is active but the filter panel row is empty.

                                  attached a photo of the filter panel when one filter is active. 

                                • Artem (DevExpress Support) 09.03.2019

                                  Hi,
                                   
                                  This behavior looks incorrect. The problem may be specific to your DataGrid configuration, which we didn't take into account. Would you please modify the Filter Panel demo to demonstrate the issue? Extract the demo into a stand-alone example using the "Copy To CodeSandBox" button and modify it using the"Save" button to apply changes. Then, post the updated link here for further examination. Or, you can use our project template as a starting point. We'll perform more detailed research.

                                • Customer93190 09.03.2019

                                  I think it's at the first render of the filter panel because if I filter by let's say 'a' the filter panel opened and the description is empty but when i write another letter to the filter row like 'ab' the description is added to the filter panel

                                • Artem (DevExpress Support) 09.04.2019

                                  Hi,
                                   
                                  I checked your example and noticed that onContentReady is not assigned to the component execution context.
                                   

                                  [JavaScript]
                                  onContentReady(e) { //... }

                                  The "this.state" object won't be available there, and you need to use the arrow function instead. Alternatively, you can use the "bind" method as we demonstrated at Event Handling
                                   
                                  Anyway, we researched this case and found a better approach. You need to use onOptionChanged and track the filterValue option to hide/show the Filter Panel.
                                   

                                  [JavaScript]
                                  onOptionChanged = (e)=>{ if (e.fullName === "filterValue") { this.setState({ filterPanel: !!e.value }) } }

                                  See the following example: https://codesandbox.io/s/datagrid-dynamically-showhide-filterpanel-in-react-3nlo5
                                   
                                   
                                  Let us know if this approach helps.

                                • Customer93190 09.04.2019
                                  1. sorry I didn't write all of my code I'm using autoBind library and working with typescript so it might be a little different from what I post.

                                  2. your's better approach sounds great (it really not seems to fit well at onContentReady)

                                  Thank you for your great efforts !

                                • Artem (DevExpress Support) 09.04.2019

                                  You're welcome! Would you mind if we make this thread public to share the solution with our community?

                                • Customer93190 09.04.2019

                                  Sure, fine by me