Pass a handler to filter button property

别等时光非礼了梦想. 提交于 2019-12-25 02:33:02

问题


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();

回答1:


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

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.



来源:https://stackoverflow.com/questions/23912837/pass-a-handler-to-filter-button-property

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!