DateField in the Table


Given: a table with some date field which stays in readMode=true. I want click on this field iwth left double click and get it into edit mode.

What i did:

  1. Created a generated column with a date field:

addGeneratedColumn("aufgegeben", new ColumnGenerator() {
			public Object generateCell(Table source, Object itemId, Object columnId) {
				DateField dateField = new DateField();
				dateField.setValue(((Lieferung) itemId).getAufgegeben() != null ? ((Lieferung) itemId).getAufgegeben() : null);
				dateField.setId("" + ((Lieferung) itemId).getId());
				return dateField;
  1. Then i made a click listener on this table who looks if some1 clicked on this field with double click:

addItemClickListener(new ItemClickListener() {

			public void itemClick(ItemClickEvent event) {
				System.out.println("CLICK ON LIEFERUNG TABLE");
				// only if this anzahl_bestellt clicked, i do something
				if (event.isDoubleClick() && event.getPropertyId().equals("lieferungcode")) {
					TextField txt = (TextField) allEditFields.get("" + ((Lieferung) event.getItemId()).getId());
					// do something only if field is still not editable. this
					// prevents of some missfire when u click into field when it
					// is open for edit.
					if (txt.isReadOnly()) {
						System.out.println("lieferungcode  field clicked. lets open it for edit");
						allEditFields.put("" + txt.getId(), txt);

				if (event.isDoubleClick() && event.getPropertyId().equals("aufgegeben")) {
					DateField dateField = (DateField) allEditFields.get("aufgegeben_" + ((Lieferung) event.getItemId()).getId());
					// do something only if field is still not editable. this
					// prevents of some missfire when u click into field when it
					// is open for edit.
					if (dateField.isReadOnly()) {
						System.out.println("aufgegeben field clicked. lets open it for edit");
						allEditFields.put("aufgegeben_" + dateField.getId(), dateField);

As you can see, my click listener handles two diff types of fields: TextField and DateField.
TextField works perfectly. I doubleClick on textField it gets catched by this clickListener and it does what i say him to do.
DateField ignores my Clicks on it, so this clicklistener gets never called, means i cant do nothing with my field.

How can i repair it? Maybe it is already repaired in later vaadin version? Are developers even aware of this problem?

Thanks for answering in advance.

Hi guys and girls!

Still fighting with this.

maybe some1 can help me a bit other way. all i want to do is table with some values. than if u doubleclick on this value it becomes editable. after field loose foicus it saves its data in db.

maybe there is some other approach to achieve this ?

One more update on the Field problem: ComboBox ignores my doubleclicks too. User can double click only on the small 2pixel area between ComboBox and CellWall, where the real table seen. On this small part of the cell double click works.

Awayiting for help and looking for solution.

Just some thoughts here.

TextField in readonly mode is just a string, this why he dont break ClickListener of the table element i think.

maybe we could swithc all elements in readOnly mode to display as TextField does? This way we could have general wy of working by all components.

Is it hard to do? Maybe some1 can say me how to develop or repair vaadin components?


the issue you’re having is due to the following code in VScrollTable:


         * Finds the TD that the event interacts with. Returns null if the
         * target of the event should not be handled. If the event target is
         * the row directly this method returns the TR element instead of
         * the TD.
         * @param event
         * @return TD or TR element that the event targets (the actual event
         *         target is this element or a child of it)
        private Element getEventTargetTdOrTr(Event event) {
            final Element eventTarget = event.getEventTarget().cast();
            Widget widget = Util.findWidget(eventTarget, null);
            final Element thisTrElement = getElement();

            if (widget != this) {
                 * This is a workaround to make Labels, read only TextFields
                 * and Embedded in a Table clickable (see #2688). It is
                 * really not a fix as it does not work with a custom read
                 * only components (not extending VLabel/VEmbedded).
                while (widget != null && widget.getParent() != this) {
                    widget = widget.getParent();

                if (!(widget instanceof VLabel)
                        && !(widget instanceof VEmbedded)
                        && !(widget instanceof VTextField && ((VTextField) widget)
                                .isReadOnly())) {
                    return null;
            return getTdOrTr(eventTarget);

[/code]Basically this allows the click events to get ‘through’ to the Table from Label, Embedded and a read-only TextField. But nothing else.

Can’t think of a workaround right now, but at least you could file a ticket at


I had a similar need and the solution I found in the “Spread sheet” example in the Book of Vaadin Examples. Check out this section: