Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    filter icon or button on listgrid filter row

    I want to override the behavior of filter icon, present at the end, of filter row in a list grid. please guide me. thanks.

    #2
    Override it to do what? This isn't set up for overrides because it seems like it could only confuse the user.

    Comment


      #3
      Originally posted by Isomorphic View Post
      Override it to do what?
      In case Isomorphic cares I'd like to present a sensible use case.

      If you set your grid to filterOnKeypress = true then the filter icon is essentially of no use. Clicking it issues an extra DS request that returns the same results already displayed in the grid (assuming the data in the DS hasn't changed). What would be useful in such cases is to replace the filter icon with a reset icon to clear all column filters at once. Of course, the icon image would have to be different too to avoid confusion.
      Our customers requested such a feature in our application and looking for ways to implement that I found this thread.

      Due to lack of an extension point the only option that came to mind was to place a custom icon/button at the exact same position as the filter icon. I'd much rather refrain from implementing such an ugly hack, though.

      Cheers,
      Marcel

      Comment


        #4
        This is how we do it:

        Code:
        listGrid.addChild(new ClearListGridFilterButton(listGrid));
        
        public class ClearListGridFilterButton extends Button {
          private ListGrid listGrid;
        
          public ClearListGridFilterButton(final ListGrid listGrid) {
            this.listGrid = listGrid;
            configureSelf();
            setClickHandler();
          }
        
          private void configureSelf() {
            setIcon(IconName.CLEAR_LIST_GRID_FILTER);
            setPrompt(Texts.get.clearListGridFilterPrompt());
            setWidth(16);
            setHeight(22);
            setSnapTo("TR");
            setBorder("0");
            setPadding(0);
          }
        
          private void setClickHandler() {
            addClickHandler(new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                listGrid.setCriteria(null);
              }
            });
          }
        }

        Comment


          #5
          fhisg: That's a really neat workaround.

          SmartGWT didn't do a good job there. While making a product they need not worry how a developer is going to use the feature but provide the feature and leave it to designer/developer whether they are going to confuse their customer or charm them.

          Comment

          Working...
          X