Pass a handler to filter button property

2019-09-06 14:44发布

So I have a handler for when I right click it , it will clear the criteria. How do I set this in setFilterButtonProperties? I want to be able to right click the filter button, it should clear all the characters I typed into the filter fields.

        addFilterEditorSubmitHandler(new FilterEditorSubmitHandler()
        {

            @Override
            public void onFilterEditorSubmit(FilterEditorSubmitEvent event)
            {
                if (event.isRightButtonDown())
                {
                    SC.warn("right clicked");
                    clearCriteria();

                }
            }

        });

setFilterButtonProperties();

标签: gwt smartgwt
1条回答
The star\"
2楼-- · 2019-09-06 15:16

Keep the functionality separate. There is no meaning of mixing two different tasks on the same button. Think from the end user's perspective.

Don't use right click of the button because that's not common practice. How come the end user know about the new functionality until and unless hover is visible? As per the icon enter image description here that looks like to apply the filters, not meant for clearing the already applied filters.

In short, create a separate button that's sole purpose is to clear the applied filter. You can add the button in the header/footer as shown here in Smart GWT Showcase.

To clear the already applied filter simply call ListGrid#fetchData() again without passing any criteria means null on click of the new button.

查看更多
登录 后发表回答