java - How to make datepicker cell editable? -
i using gwt datepicker cell in celltable. here onclick event , on enter event popups datepicker , set cell value date have selected. want remove selected date cell , make cell blank , workaround this?
edit:
public void onbrowserevent(context context, element parent, date value, nativeevent event, valueupdater<date> valueupdater) { super.onbrowserevent(context, parent, value, event, valueupdater); if ("click".equals(event.gettype())) { valueupdater.update(null); } }
from understand want delete date table cell.
one way modify constructor of datepickercell
and add button clears date.
first copy com.google.gwt.cell.client.datepickercell
in progect
unfortunately editors can't modified , have copy editor. (all members private)
horizontalpanel horizontalpanel = new horizontalpanel(); button button = new button("clear"); button.addclickhandler(new clickhandler() { //@override public void onclick(clickevent event) { // remember values before hiding popup. element cellparent = lastparent; date oldvalue = lastvalue; object key = lastkey; int index = lastindex; int column = lastcolumn; panel.hide(); // update cell , value updater. date date = null; setviewdata(key, date); setvalue(new context(index, column, key), cellparent, oldvalue); if (valueupdater != null) { valueupdater.update(date); } } }); horizontalpanel.add(button);
Comments
Post a Comment