I want to override the behavior of filter icon, present at the end, of filter row in a list grid. please guide me. thanks.
Announcement
Collapse
No announcement yet.
X
-
Originally posted by Isomorphic View PostOverride it to do what?
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
-
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
Comment