I am using GWT datepicker cell in my celltable. Here onclick event and on enter event it popups datepicker and set the cell value to the date we have selected. Now i want to remove the selected date from cell and make the cell blank , any workaround for 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 what I understand you want to delete a date from a table cell.
One way to do this is to modify the constructor of DatePickerCell
and to add a button that clears the date.
First copy com.google.gwt.cell.client.DatePickerCell
in your progect
Unfortunately the editors can't be modified and you have to copy the editor. (All members are private)
HorizontalPanel horizontalPanel = new HorizontalPanel();
Button button = new Button("Clear");
button.addClickHandler(new ClickHandler()
{
//@Override
public void onClick(ClickEvent event)
{
// Remember the values before hiding the popup.
Element cellParent = lastParent;
Date oldValue = lastValue;
Object key = lastKey;
int index = lastIndex;
int column = lastColumn;
panel.hide();
// Update the cell and 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);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.