java - ComboBoxTableCell JavaFX -
i have class arraylist of localdate
public class item { private arraylist<localdate> dates; }
and tablecolumn in class
observablelist<item> itemobservablelist = fxcollections.observablearraylist(); tablecolumn<item, localdate> datescolumn = new tablecolumn<>("dates"); datescolumn.setcellfactory(param -> new comboboxtablecell<>());
i figured how set cellvaluefactory column, want comboboxtablecell have values object of item class. every combobox should have it's own values based on item object.
you can @override comboboxtablecell
's startedit()
method this:
datescolumn.setcellfactory(param -> new comboboxtablecell<item,localdate>(){ @override public void startedit() { item item = (item)gettablerow().getitem(); getitems().setall(item.getdates()); super.startedit(); } });
so have dates in comboboxes each individual row item's dates. may define stringconverter<localdate>
it.
Comments
Post a Comment