Is there some possibility to add additional button to ListGrid filter? I need button that clears all filter values
Announcement
Collapse
No announcement yet.
X
-
Hi god_gav,
We are currently trying the same. We are not yet finished to test if it really works but it seems to work by setting filterEditorProperties on the ListGridField and then set the icons field. Here is a definition of a list grid field as an example:
Code:{title: 'name', name: 'name', filterEditorProperties : {required: false, icons : [ { src :"[SKINIMG]../../images/MyGreatClearImage.png", click: function (form, item, icon) { item.setValue(null); } }], }
One other thing I am not yet sure how to do is to set the form item value in such a way so that the grid automatically gets refreshed. If I find that out then I will let you know. It would be great if you can do likewise ofcourse.
gr. Martin
-
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