gwt - DatePickerCell breaks table selection -
when click on cell datepickercell table selection no longer works.
the table below has 2 columns: date,text
tested gwt 2.4 , 2.5 tested chrome, ie9
is there wrong code posted?
is there link working example of datagrid selectionmodel , datecellpicker, selection works ok?
a working example answer question.
update:
i posted complete runnable example.
import com.google.gwt.cell.client.datepickercell; import com.google.gwt.cell.client.fieldupdater; import com.google.gwt.core.client.entrypoint; import com.google.gwt.user.cellview.client.*; import com.google.gwt.user.client.window; import com.google.gwt.user.client.ui.rootpanel; import com.google.gwt.view.client.selectionchangeevent; import com.google.gwt.view.client.singleselectionmodel; import java.util.arrays; import java.util.date; import java.util.list; /** * entry point classes define <code>onmoduleload()</code>. */ public class datagridcss implements entrypoint { /** * simple data type represents contact. */ private static class contact { private final string address; private date birthday; private final string name; public contact(string name, date birthday, string address) { this.name = name; this.birthday = birthday; this.address = address; } } /** * list of data display. */ private static final list<contact> contacts = arrays.aslist(new contact("john", new date(), "123 fourth avenue"), new contact("joe", new date(), "22 lance ln"), new contact("george", new date(),"1600 pennsylvania avenue")); public void onmoduleload() { final datagrid<contact> table = new datagrid<contact>(100); table.setsize("700px", "300px"); table.setkeyboardselectionpolicy(keyboardselectionpolicy.enabled); // add date column show birthday. datepickercell datecell = new datepickercell(); column<contact, date> datecolumn = new column<contact, date>(datecell) { @override public date getvalue(contact object) { return object.birthday; } }; // add field updater notified when user enters new name. datecolumn.setfieldupdater(new fieldupdater<contact, date>() { @override public void update(int index, contact object, date value) { object.birthday = value; } }); table.addcolumn(datecolumn, new textheader("birthday")); textcolumn<contact> addresscolumn = new textcolumn<contact>() { @override public string getvalue(contact object) { return object.address; } }; table.addcolumn(addresscolumn, new textheader("address")); // add selection model handle user selection. final singleselectionmodel<contact> selectionmodel = new singleselectionmodel<contact>(); table.setselectionmodel(selectionmodel); selectionmodel.addselectionchangehandler(new selectionchangeevent.handler() { public void onselectionchange(selectionchangeevent event) { contact selected = selectionmodel.getselectedobject(); if (selected != null) { window.alert("you selected: " + selected.name); } } }); table.setrowcount(contacts.size(), true); table.setrowdata(0, contacts); rootpanel.get().add(table); } }
from source code of abstractcelltable looks like, have either use keyboardselectionpolicy.bound_to_selection or provide @ least 1 cell type handles selection.
filed bug report google:
http://code.google.com/p/google-web-toolkit/issues/detail?id=8064
Comments
Post a Comment